This Windows guide will teach you how to restore your iPhone 3GS to 3.1.2 instead of 3.1.3 using the SHSH details stored on Cydia for your 3GS.
This method also works to restore iPhone 3GS devices to 3.1.2 instead of 3.1.3 for many that have encountered an error with sn0wbreeze (as long as you haven’t panic’d and done a normal 3.1.3 restore via iTunes already).
If you have already restored on stock Apple firmware 3.1.3 via iTunes this guide may leave your phone unable to connect to the network (the 3.1.3 baseband and 3.1.2 firmware may not work well together).
The first requirement is that Cydia has your SHSH details stored for 3.1.2. If you have opened Cydia and seen green text at the top “This device has SHSHs on file for iPhone OS: 3.1.2″ then you can restore to 3.1.2.

You need to edit your host file to connect to Saurik’s server instead of Apples to sign the 3.1.2 firmware when you restore.
Windows Vista and Windows 7 users make sure the program Notepad has Administrator privileges (find Notepad, right click, select Run as Administrator).
On your Windows PC Browse C->WINDOWS->system32->drivers->etc
(if you installed Windows on a different drive letter browse to that on instead of “C”)
Right click on hosts and select Open.
Choose Notepad and click OK.
Add “74.208.10.249 gs.apple.com” at the end of the file. Save it.
Before continuing enter restore mode. One way to do this is disconnect your phone from the computer and turn your phone off. Start iTunes. Hold the home button on your phone and plug it in. Continue holding the home button until iTunes indicates you are in restore mode.
Now you’ll be at a screen similar to the one below. Hold the Shift key while you click Restore.
Browse to the 3.1.2 firmware file you downloaded earlier. Select it and click Open.
Click Restore.
iTunes will does its thing.
Once done your phone will reboot and you’ll be back on 3.1.2.