How to fix iPhone 3G "Random Error 1645".
1. Disconnect your iPhone cable but leave connected the other USB end to the computer.
2. Turn off your iPhone holding the Sleep/Wake button. The red slider bar appears. Slide the bar and wait until the iPhone turns off. Or you could hold the Sleep/Wake and Home buttons at the same time until the iPhone turns off.
3. While pressing and holding the Home button connect the USB cable to your iPhone. It should power on. Hold the Home button until you see the "Connect to iTunes" message. Open iTunes if necessary. You should see the "iTunes detected an iPhone in recovery mode..." alert screen.
4. Choose "Restore".
Thanks.
iMac, Mac OS X (10.5.8)