Downgrade iOS 4 to iPhone 3.1.3 Firmware on iPhone and iPod:
Couple of days ago Apple published their new IOS 4. This particular IOS supports most of its products, such as Iphone 3gs, 3g as well as Ipod 3g and 2g. Just like any other release, this IOS had been downloaded by tons of Apple users across the globe, however, some of these users have not found this update very useful and now want to revert back to old firmware, which in this case is 3.1.3. This guide below covers the methods used to downgrade to 3.1.3.
In order to step down your firmware on either IPhone 3G and iPod Touch, you have to make sure you have ECID SHS certificates for the previous firmware 3.1.3.
You need to begin by navigating your way to c:\windows\system32\drivers\etc\ There you will be able to spot your hosts file, now open that file in your notepad, so that you can edit it later. You can open that in notepad by right clicking on the file, which shall open a drop down menu, select open with and then click on notepad. Now once its opened, scroll your page down to the end of this page and add this line 18.104.22.168 gs.apple.com
Now connect your iPhone to iTunes in recovery mode. To do so, first switch off your device. Then press the Home button on your handset and connect the USB cable.
Switch into recovery mode and connect your Iphone 3g or whichever compatible version you have to iTunes. You need to follow the following steps to get into the recovery mode.
Now that you have successfully loaded your device into recovery mode, you can reset your device. For Windows users, you need to press SHIFT tab, but for Mac users, you need to hold Alt tab, while doing this, click on restore option in iTunes.
At this point, you need to select previous OS 3.1.3, once its loaded on your device, you can enjoy all the benefits this OS has to offer.
For further details and better techniques, try Source