Just remember in jailbreaking you are taking a risk & something could happen to your iphone. It's unlikely to harm it though & they estimate around 10% of iphones are jailbroken.
All you want to do is "jailbreak" your phone. You do not need to "unlock" it. Jailbreaking allows you to add forbidden software. Unlocking allows you to use the iphone with a carrier other that AT&T. Blackra1n jailbreaks. It does not unlock.
Be sure to go to itunes, sync & backup your phone, uncheck the automatic syncing option, close itunes, then hit control/atl/delete & look under PROCESSES & turn off all Apple related services (like...iPodService.exe, iTunesHelper.exe, mDNRSResponder.exe, AppleMobileDeviceHelper.exe) except the AppleMobileDeviceService.exe before attempting your jailbreak.
If your iphone is up to date with firmware 3.1.2 (which it should be) you will need to use "blackra1n" (yes that is a one not an i) for the jailbreak.
If all goes well all you do is download blackra1n, plug your iphone into the computer via the USB cable. click on the blackra1n icon, then click "make it rain", a 20th century-looking mans picture appears on your phone, it reboots, then you scroll to the end of your APPS, you should see blackra1n, open it, then install Cydia. Cydia can be a bit slow. From all I read
you should not install "Icy" as it can cause problems & whatever the 3rd option is isn't worth a hoot so I didn't install it either

If your phone gets stuck at the picture of itunes & a USB plug the jailbreak is not working & you need to soft reboot... hold down HOME button & POWER button at same time until you see Apple logo, then let go of both. Phone will then be back to normal & you can try again.
HERE are step by step pics of a jailbreak.
More step by step pics showing the jailbreak
http://www.youtube.com/v/nUJkJvtTRRs&rel=1Video of how to jailbreak (but after all I read I say DO NOT install Cydia, Rock, & Icy all at once & do not install Icy at all. Only install Cydia!!)
http://www.youtube.com/v/P32KXTqEmfA&rel=1Here is a fix when you get stuck during jailbreak that has worked for many...
http://www.youtube.com/v/w8UYSfPEKnQ&rel=1Here is the fix that made my jailbreak work (I had to run as ADMIN even though I use Window's xP. How odd cause i always thought that was only a Vista thing)
http://www.youtube.com/v/wG9LWil6QZE&rel=1It is really easy & if you run don't get stuck (like I did) at the itunes/USB screen you will be jailbroken in under a minute

If you give it a try & have any problems be sure to ask. I will PM you my phone number if you need to call for help but... keep in mind I am just learning too
