As of the moment, there's no jailbreak available for iPhone 3GS running iOS version 4.0.2.
If you upgraded to iPhone 3GS's firmware to the latest version but you now want to jailbreak the device, then you might want to first downgrade to 4.0.1 as there's already an easy to perform jailbreak available for that.
Here's to do it in 8 easy steps:
DISCLAIMER: This blog can NOT be held responsible for any damage that may be caused by this step-by-step downgrade procedure. Please consult a number of downgrade guides online before proceeding. Downgrade your iPhone 3GS' firmware to 4.0.1 at your own risk.
Note that this downgrade guide will only work for iPhone 3GS with SHSH blobs or ECID SHSH saved on Cydia for 4.0.1 firmware. If you don't have the said SHSH files saved, I'm sorry but it's impossible to downgrade your device. If eventual jailbreaking is your main motivation for downgrading, it would be best to just wait for a working 4.0.2 jailbreak to surface.
1. Download iOS 4.0.1 for iPhone 3GS via this link.
2. Edit Hosts file
a.) In Accessories, right click Notepad & choose Run as Administrator. Keep Notepad open.
b.) Using Windows Explorer, navigate to C:/Windows/System32/drivers/etc & look for Hosts file
c.) Open Hosts file simply by dragging it to previously opened Notepad
d.) Add this line at the bottom of Hosts file's content:
e.) Save revised Hosts file
Using Mac OS X
a.) Navigate to "/etc/" directory by clicking "Go –> Go to Folder" from Finder.
b.) Using TextEdit, Open Hosts file
c.) Add "220.127.116.11 gs.apple.com" below the last line of the document and save.
4. Select iPhone 3GS in iTunes.
5. Press the power button and home button of your iPhone 3GS for 10 seconds. Release the power button but keep holding down the home button until iTunes recognizes the device is trying to enter DFU Mode. Check the iPhone screen to know if you're already in DFU mode; it must be black or blank.
6. Once your iPhone 3GS is in DFU mode, hold down Shift Key in Windows or Option Key in OS X and click Restore button.
7. iTunes will prompt you to choose the location of the 4.0.1 firmware file that you earlier downloaded. Select the 4.0.1 ipsw file and click Open. Let iTunes install the firmware. Now at some point during the installation, iTunes may show 1011, 1015 or 1013 error -- just ignore the error message.
8. Using Recboot (download it here, exit recovery mode and reboot the iPhone 3GS.
Let me know if the process worked for you. Please leave a comment below. Thanks!