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.
This tutorial should work with Windows XP, Vista and 7.
Open your web browser of choice and navigate to http://www.purplera1n.com. Click the Windows logo at the bottom of the screen.
When prompted save the download to your desktop
Double click the purplera1n.exe file from the desktop to launch the application
Click the large make it ra1n button
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.
Once your device reboots you will see a new icon on the SpringBoard entitled Freeze. Press it to continue.
Once Freeze opens tap Install Cydia.
Once the Cydia installation has completed you must reboot your iPhone.
When you iPhone has rebooted you can run Cydia. Let it do all the necessary updates then follow our Unlock tutorial 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. We will post a tutorial on this shortly.
THANKS*: A big thanks goes to GeoHot for his work in making this jailbreak possible. Also thanks to others who contributed such as chronic and the dev-team and to Mateen for the nice screenshots!