After jailbreaking with PwnageTool here is a tutorial on how to unlock using UltraSn0w. It is now possible to upgrade to the iOS4.1 firmware, while preserving your baseband by using the new Pwnage tool. Below is a tutorial on how to unlock your iPhone running a custom cooked iOS4.1 firmware.

UltraSn0w 1.1-1 supports the following iDevices :

* iPhone 3G
* iPhone 3GS
* iPhone 4

Note: UltraSn0w works only if you have jailbroken you iPhone with the Pwnagetool 4.1.

Unlock iPhone On iOS4.1 With UltraSn0w 1.1-1 [How To] :

1) Firstly, you have to create a custom cooked iOS4.1 firmware (tutorial here).
 
2) Now, launch Cydia and search for UltraSn0w. Once you see UltraSn0w in the search results make sure that it is version 1.1-1. If you UltraSn0w is not version 1.1-1 refresh Cydia’s sources. Now, Install UltraSn0w 1.1-1 on your iPhone.



3) After installing UltraSn0w, reboot your iPhone.

After your iPhone successfully reboots, you should have an unlocked iPhone running the iOS 4.1 firmware.

Do let us know how it goes in the comments section below.