Click the image to open in full size.
In the flurry of upgrades and jailbreak tools, many may have come to the realization that they are not yet ready for iOS 4 for various reasons, wether it be a new bootrom, or you simply miss your Jailbroken apps from Cydia, this guide will help you downgrade your recent update to iOS 4 back to 3.1.x. While it is highly recommended to restore to 3.1.2, some of you may not have that option, but only use 3.1.3 as a last resort. However, it is important to note that if you are downgrading, in order to upgrade to iOS 4 JB, you MUST be on 3.1.2. The only jailbreak for 3.1.3 is Spirit, which is NOT compatible for upgrading to iOS 4 Jailbroken.

Before we even get started, you must have your SHSH blobs on file with Saurik’s server. You can tell if you have this by opening cydia and seeing a message similar to this:
Click the image to open in full size.

If you are 100% sure you have this message, and recall choosing the “Make My Life Easier” option when you first launched Cydia, then it’s time to proceed. If you unfortunately do not have these saved, and are already on iOS 4, then there is nothing you can do.

Ok, so you made it past the hump. You have SHSH blobs on file via Saurik’s Cydia server, which means your going to be able to downgrade just fine. The next question is, which firmware would you like to downgrade to. In my case, I don’t have SHSH blobs on file for 3.1.2, so I will be downgrading to 3.1.3 instead.

Grab your stock firmware from the links provided at the end of this thread. Make sure you are using the one you have SHSH blobs on file for.

Now that we’ve got this far, its time to begin:
Note: This guide ONLY applies to the 3GS
Step 1: Modify the Hosts file

In order to trick iTunes into connecting to Saurik’s server instead of Apple, we need to modify the hosts files. This applies to both Windows and Mac users. By doing this, we are able to get iTunes to think that our device is eligible for a downgrade. Normally when a new firmware is released, the older firmwares are no longer signed by Apple, thus preventing downgrading, but by connecting to Saurik’s server, we bypass this issue. 

1a: Modifying Windows Hosts file
Click the image to open in full size.

Browse to Windows\System32\drivers\etc\. Inside this directory you should be able to find a file named “Hosts”. Open this in Notepad and add the following line to the bottom.

Quote:
74.208.10.249 gs.apple.com

Due to some restrictions on Windows you may have to create a copy of this file on your desktop and then drag and drop it to replace.
Click the image to open in full size.
1b: Modifying Mac Hosts File

The same idea as windows here, only in a different location. On your Mac, Open Finder, and choose Go from the toolbar, and then Go To Folder. Type in the following: etc/ .
Click the image to open in full size.

This folder should pop up, and inside you’ll see the hosts file. Open this file with textedit and add the following line to the bottom.

Quote:
74.208.10.249 gs.apple.com

Save the file.
Click the image to open in full size.

2: Install Firmware Manually
Click the image to open in full size.

Now you can launch iTunes, shift click, or ctrl click, Restore, choose your firmware, and the downgrade begins. Some of you may not have any problems from here, but some of you will end up in recovery mode by the end of it. Do not worry, this is normal. Now we just need to force the phone out of recovery mode.
Click the image to open in full size.

3: Fix Recovery Boot Loop

In our case, I used iReb to easily fix the recovery boot method. This is of course on Windows, but you can also use many of the methods out there to fix the recovery loop. If you need further help with this, post a reply.
4: Welcome Back to 3.1.x. 

Your back. Now you can patiently wait for further development on iOS 4 in the meantime and have all your fun apps back. Hope this helps everyone. I Will add photos shortly.

Resources & Links:
We have had guides for downgrading the 3GS to 3.1.2 for awhile now check em out if you need more instruction
Downgrade 3GS to 3.1.2 on a Mac
Downgrade 3GS to 3.1.2 on Windows
3.1.2 Firmware (Official Apple Links)
Download iPhone OS 3.1.2 for iPhone 2G Download iPhone OS 3.1.2 for iPhone 3G Download iPhone OS 3.1.2 for iPhone 3GS
3.1.3 Firmware (Official Apple Links) -
 Only use these if you do not have 3.1.2 on file.
Download iPhone 3.1.3 firmware for iPhone 2G 
Download iPhone 3.1.3 firmware for iPhone 3G Download iPhone 3.1.3 firmware for iPhone 3GS
Utilities
iReb for Windows (Mac Soon)iRecovery (Mac & windows)