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.0 firmware.
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, 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...
For your convenience this unlock tutorial is available in video format also. Click the Watch It button to view the tutorial!
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 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!
***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.