For those of you who have upgraded to iOS 4, you will need to actually downgrade it back to 3.1.2 or 3.1.3 to jailbreak/unlock your iPhone 2G, 3G, or 3Gs.
I was actually trying to do this for one of my friends lately but it seems like Apple has blocked people from doing this anymore BUT if you already jailbroke your iPhone 2G/3G/3Gs before upgrading to iOS4, you can still jailbreak it.
Apple uses a signature server which can be hacked via using Cydia’s signature server. The catch is that you need to actually sign your iPhone before upgrading to iOS4.
For those of you who have not upgraded yet to iOS4, you should start using Cydia’s fake server as it allows you to downgrade later on.
The process of downgrading from 4.0 to 3.1.2/3.1.3 is rather simple.
1. You will need to first point your signature server to Cydia by changing your Hosts file on your computer.
2. Download the 3.1.2 or 3.1.3 restoration firmware for your iPhone 2G/3G/3Gs.
3. Also make sure to backup all your stuff on iTunes.
4. Put your iPhone into DFU mode by pressing the Power button WHILE holding down the Home button.
5. Open iTunes, you should be in Recovery mode.
6. Click on “Restore” while holding down the shift key and you will get a pop up to choose your firmware of choice.
7. iTunes will restore/downgrade your iPhone from 4.0 to 3.1.2 or 3.1.3 and give you error code 1015.
8. If you get error code 3194, you are currently out of luck because you have not saved your SHSH Blobs on Cydia’s server.
Also see this video of downgrading from 4.0 to 3.1.3