These are instructions on how to unlock the iPhone 4, iPhone 3GS, and iPhone 3G for use with any GSM cellphone carrier using UltraSn0w. This will work with the iOS 4.2.1 firmware if you are on the 06.15.00 baseband.
Before you can follow these instructions you must have a jailbroken iPhone and you must be on the 04.26.08, 05.11.07, 05.12.01, 05.13.04, 06.15.00, or 01.59 baseband(modem firmware).
To find your firmware and modem firmware(baseband) versions you can follow this tutorial.
If you are on T-Mobile remember to turn off 3G 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
If the ultrasn0w repo is not present press the Edit button at the top right of the screen. Otherwise, skip to Step Nine.
Press the Add button at the top left of the screen.
Enter http://repo666.ultrasn0w.com/ as the source url and press the Add Source button.
Once the source has been added press the large Return to Cydia button.
Press the Done button at the top right of the screen.
Press to select repo666.ultrasn0w.com from the list of user entered sources.
Press to select ultrasn0w from the list of packages
Press the Install button at the top right of the screen.
Press the Confirm button at the top right of the screen.
After installation completes successfully press the large Restart Springboard button.
You should now be able to insert the SIM of your choice!
***THANKS: A big thank you to all the members of the iPhone Dev-Team for all their hard work! It is much appreciated by all.