George Holtz, aka Geohot who is a member of the iPhone Dev Team and the first people to unlock the original iPhone (iPhone 2G) has released a software to general public that called purplera1n to jailbreak iPhone 3G S (or 3GS) on iPhone firmware OS software 3.0. However, purplera1n will only allow jailbreak iPhone 3GS to allow installation of unofficial third-party applications which is not approved on Apple App Store, and will not unlock the iPhone 3GS to allow carrier-locked iPhone 3GS to use other mobile provider’s SIM card, which can be done with Ultrasn0w.

iPhone Dev Team actually plans to release the jailbreak for iPhone 3GS only after iPhone OS software version 3.1 is released. However, George Holtz decided that this is not how game should be played, and release the purplera1n anyway. purplera1n is based on IBoot Environment Variable Overflow hole in iPhone OS to make jailbreak works.
purplera1n works on Windows XP, Windows Vista and Windows 7, including 32-bit and 64-bit versions with the release of purplera1n RC2, which also includes some kernel patches and bug fixes, although there is still no winterboard support. A Purplera1n Mac version has also been released.The installation of purplera1n will required the latest iTunes (iTunes 8.2) installed and an iPhone 3GS with the iPhone 3.0 firmware. iPhone 3G and 1st generation iPhone users should use PwnageTool and Redsn0w to jailbreak instead.
The purplera1n is available for free download purplera1n.com or directly download purplera1n.exe and user is recommended to make full a backup of the phone before running the software.
These are instructions on how to jailbreak your iPhone 3GS using PurpleRa1n for Windows. Once you have completed this tutorial you will be able to unlock your iPhone 3GS using this tutorial. 

This is a preliminary jailbreak and thus some apps such as Winterboard will not work. You may want to consider waiting for the jailbreak release from the iPhone Dev-Team if this is important to you.

Jailbreak Your iPhone 3GS Using PurpleRa1n 

This tutorial should work with Windows XP, Vista and 7.

Step One
Open your web browser of choice and navigate to http://www.purplera1n.com. Click the Windows logo at the bottom of the screen.

Step Two
When prompted save the download to your desktop

Step Three
Double click the purplera1n.exe file from the desktop to launch the application

Step Four
Click the large make it ra1n button

Step Five
You iPhone will now be placed in recovery mode. You will see a picture of GeoHot that replaces the regular recovery mode screen on your device.

purplera1n will run and then your device will reboot.

Step Six
Once your device reboots you will see a new icon on the SpringBoard entitled Freeze. Press it to continue.

Step Seven
Once Freeze opens tap Install Cydia.

Step Eight
Once the Cydia installation has completed you must reboot your iPhone.

Step Nine
When you iPhone has rebooted you can run Cydia. Let it do all the necessary updates then follow our Unlocktutorial to finally unlock your iPhone 3GS.

NOTE*: To remove the Freeze icon from your desktop you can install CyDelete from Cydia then use it to delete the application. 

Source : mydigitallife.info, iclarified.com