Warning: Limera1n is only jailbreak tool not an unlock, so if you want to unlock your iPhone with ultrasn0w then you should not upgrade your device to iOS 4.1 because the baseband will also be upgraded and right now there is no unlock tool available for that baseband version.
Jailbreak iOS 4.1 on iPhone 4 or iPhone 3GS
Connect your iPhone to your system with USB and launch limera1n.exe which was just downloaded
To start jailbreak process click make it ra1n button which will display on screen
Limera1n will detect your attached iPhone and start entering your device to recovery mode
Now, follow the on screen instructions which will put your iPhone into DFU mode
First, hold home + power buttons and keep holding until screen changes the message
Then release Power button by holding the Home button. Your device will prepare to enter into DFU mode
When iPhone enter into DFU mode successfully, limera1n will start jailbreak process which takes less than 30 seconds to complete and done message will display on your system’s screen
Now, simply disconnect your iPhone from system and Power ON it. You will find limera1n icon on your device, tap on it and select Cydia and tap Install
When Cydia will complete installation on your iPhone it means all is done
Note: In case if you could noy find Cydia icon on your iPhone after doing step 8, just reboot your iPhone.