Apple recently released iOS 4.0.1 for iPhone and iPod Touch. Since the baseband was not upgraded from 05.13.04, the jailbroken iPhone on iOS 4.0.1 can be unlocked easily using ultrasn0w. Ultrasn0w 0.93 works for all basebands since iPhone 3.0 FW and make sure to disable 3G if you are on T-Mobile USA. Follow steps below to run Ultrasn0w to Unlock iPhone 3G on iOS 4.0.1
How to Unlock iPhone iOS 4.0.1 Baseband 04.26.08 to 05.12.08 with Ultrasn0w 0.93
Step 1 - Follow the complete guide to jailbreak your iPhone 3G on iOS 4.0.1 using Redsn0w 0.9.5b5
Step 2 - Start Cydia on your jailbroken iPhone 3GS iOS 4 springboard.
Step 3 - Select Manage tab at the bottom of your iPhone screen and then select Sources.
Step 4 - Select Edit and then select Add. Now enter a URL source. Type repo666.ultrasn0w.com and select on Add Source. Once Cydia has added the source click on Return to Cydiabutton.
Step 5 - Once the installation is completed. Search for ultrasn0w 0.93 in Cydia and install it.
Step 6 - This app will automatically unlock your jailbroken iPhone baseband 05.13.04 (on iOS 4.0.1)
Step 7 - Reboot it. You have now successfully unlocked iOS 4.0.1 firmware running 05.13.04 and 05.12.08 baseband respectively or any baseband since iPhone 3.0 FW.