If you have a previously jailbroken iPhone 3G at 3.1.2 that was NOT jailbroken with Spirit, you can create a custom ipsw file with PwnageTool 4.01 (Mac) or sn0wbreeze v1.6.2 (Win) and restore the device in recovery or
DFU mode. If you have an out-of-the-box 3G, then use DFU mode.
*If you have a Jailbroken 3.1.3 iPhone 3G it is very possible that this can fail from recovery mode, if this failure happens you will need to restore using DFU mode.
...