The following instructions will show you how to unlock the iPhone 3GS so you can use it with any GSM cellphone carrier using PurpleSn0w. Geohot has posted stating that the purplesn0w unlock should improve issues with wifi, battery, and the unlock itself. If you would prefer to use the iPhone Dev-Teams UltraSn0w unlock you can find the tutorials by clicking here
Before you can unlock your iPhone, you must have an already jailbroken iPhone and must be on the 04.26.08 baseband(modem firmware). Which means that you must be running on 3.0 firmware and have used PwnageTool, RedSn0w, or PurpleRa1n to jailbreak it. YOU MUST ALSO (FOR THE TIME BEING) HAVE ACTIVATED YOUR IPHONE WITH AN OFFICIAL APPLE CARRIER. NO HACTIVATION SUPPORT YET.
To find your firmware and modem firmware(baseband) versions you can follow this tutorial. If you are not on baseband version 04.26.08 then you need to follow one of the the following tutorials before proceeding to unlocking: Mac, Windows
If you are on T-Mobile or any carrier without 3G remember to turn it off before starting…
Press to launch Cydia Installer from your SpringBoard.
Press to select the Manage tab at the bottom of the screen.
Press to select the large Sources button
Press Edit at the top right of the screen.
Press Add at the top left of the screen.
Enter http://apt.geohot.com/ as the source url and press Add Source.
Once the source has been added press the large Return to Cydia button.
Press Done at the top right of the screen.
Press to select apt.geohot.com from the list of user entered sources.
Press to select com.geohot.purplesn0w from the list of packages
Press Install at the top right of the screen.
Press Confirm at the top right of the screen.
After installation completes successfully press the large Return to Cydia button.
Now press the Home button then power off and power on the iPhone. You do this by holding down the power button for 3 seconds then moving the power slider that appears to the right. Press the power button again to turn on the phone.
You should now be able to insert the SIM of your choice!