This procedure will cause you to upgrade your baseband potentially ruining your chances for an unlock. Please follow a tutorial on how to update to iOS 5.0.1 using a custom ipsw if you need an unlock.
If you want to jailbreak a lower firmware version you can find the appropriate tutorial here.
Create a folder on your desktop called Pwnage
Download the latest RedSn0w from here and place it in the Pwnage folder. Likewise, download the 5.0.1 firmware from here and place it in the Pwnage folder.
Extract the RedSn0w zip file by double clicking it.
Step Two: (Skip this step if you're on iOS 5.0.1 already)
Connect your iPhone to the computer and launch iTunes.
Select your iPhone from the list of devices on the left. Now hold down Shift and click the Restore button. Restore is preferred as it won't create any wasted space on your iPhone.
Navigate to the Pwnage folder on your desktop and select the 5.0.1 firmware ipsw. Click the Choose button to continue.
iTunes will now update your iPhone to the new firmware.
Launch the redsn0w application from the redsn0w folder we extracted earlier.
**Windows 7 users may want to try running the redsn0w executable mode as an administrator in Windows Vista compatibility. You can do this by right clicking the executable and selecting Properties from the contextual menu.
Once RedSn0w opens click the Extras button
Choose Select IPSW from the Extras menu.
Select the iOS 5.0.1 firmware ipsw from Pwnage folder on your desktop and click Open.
When asked tell RedSn0w whether you have a new model or older model of the iPhone 3GS then click the the Back button.
Press the Jailbreak button to continue.
Plug your iPhone into the computer and make sure its OFF then click the Next button
RedSn0w will now guide you through the steps to get into DFU mode. You can find more help with DFU mode here
Hold down both the Home button and the Power button for 10 seconds.
Release the Power button and continue holding the Home button until RedSn0w detects the device.
Your iPhone will now reboot
RedSn0w will prepare the jailbreak data.
Select Cydia from the list of options and click Next.
Your iPhone will now be rebooted again and RedSn0w will begin uploading the new RAM Disk and Kernel.
Once this is complete you will be notified that RedSn0w is done. When your iPhone finishes rebooting (5 minutes or so) it will be jailbroken with Cydia on the SpringBoard.
*As usual a big thanks to the iPhone Dev-Team, Chronic Dev-Team, pod2g, and Geohot for their hard work and contribution to the iPhone community.