Please note that the guide below will show you how to jailbreak iPhone 3GS firmware 3.0 and 3.0.1 only. If it’s on firmware 3.1 or 3.1.2, you can jailbreak your iPhone 3GS using blackra1n. Download redsn0w 0.8 and firmware 3.0 ipsw to your PC.
Launch the redsn0w and iTunes will automatically closed. On welcome page, click Browse button and locate the iPhone firmware. It’ll identify the iPhone firmware.
Then, click Next button and the redsn0w will patch the selected iPhone firmware. Once it’s done, click Next button and you can choose both Cydia and Icy installers, but I prefer to install only Cydia installer.
Disconnect and power off iPhone 3GS. Then, while holding home button connect iPhone 3GS to your computer and keep holding home button till iTunes logo appears on the screen.
Then, release home button when the redsn0w is starting to upload the files to your iPhone 3GS and when the redsn0w done, your iPhone 3GS will reboot.
You’ll see Cydia installer on your iPhone home screen when it has rebooted and your iPhone 3GS is successfully jailbroken.
P/S: To unlock your iPhone 3GS, install the ultrasn0w through Cydia installer.