The following instructions will show you how to unlock the iPhone 3G and iPhone 3GS so you can use it with any GSM cellphone carrier using UltraSn0w.
You must have an already jailbroken iPhone before you can continue to unlock it. Also, you must be on the 04.26.08 baseband(modem firmware). Which means that you must be running the 3.0 firmware and have used PwnageTool or RedSn0w to jailbreak it.
To find what are your firmware and modem firmware(baseband), you can follow this tutorial. You need to follow one of the following tutorials before unlocking, if you are not on baseband version 04.26.08: Mac, Windows
If you are on T-Mobile, remember to turn off 3G before starting…
Press to launch Cydia Installer from your SpringBoard.
Select the Manage tab at the bottom of the screen.
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://repo666.ultrasn0w.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.
Select repo666.ultrasn0w.com from the list of user entered sources.
Select ultrasn0w 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 Home and 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!