The BlackRa1n jailbreak will work with the 3.1.2 firmware but not the latest 3.1.3 firmware.
For those with the new iPod touch or newer iPhone 3GS, BlackRa1n only supports a tethered jailbreak. This means that once jailbroken you should not let your battery die. If it does die you will need to reconnect it to the computer and use BlackRa1n to boot it.
Ok lets begin...
Open your web browser of choice and navigate to http://www.blackra1n.com. Click the Apple logo at the bottom of the screen.
When prompted save the download to your desktop
Then double click the downloaded blackra1n zip file to extract the application, then double click the application icon to launch the program
Make sure your iPhone or iPod is connected to the computer then 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.
blackra1n will run and then your device will reboot.
A popup message will appear informing you that BlackRa1n is free software and if you appreciate it you can donate to GeoHot at firstname.lastname@example.org.
Once your device reboots it will be jailbroken and you will notice a blackra1n icon on the desktop. Make sure you have an internet connection and press to launch the application.
Choose the installer application of your choice then press the Install button at the top right of the screen
BlackRa1n will begin to download and install the package you selected.
Once complete BlackRa1n will respring your iPhone and you will find the installer package of your choice on the Springboard.
Once you have confirmed your installer package is working correctly you may use the Uninstall blackra1n button inside the BlackRa1n app to remove it from your springboard.
***THANKS: A big thanks to Geohot for making this jailbreak possible. Also thanks to those who contributed to making it a success.