PLEASE LET IT BE KNOWN, IF YOU USE ANY OF THESE PROCEDURES YOU DO SO AT YOUR OWN RISK.
This article is for the 2g updated to 3.1.3 firmware, but I believe it will work with 3g or 3gs running under 3.1.3 firm ware.
I have been working on this for a bit. It can be very time consuming to find exactly what you need to to unlock and jailbreak your iphone/itouch. You can scourer the internet and Youtube to get info and try to find all the software need to do this. Many methods do not work, but I found these steps do work and work very well. You can learn here from my mistakes, to make your experience pretty much hassle free.
Once you do jail break a couple of problems you will have is the Youtube connection will not work. when you press Youtube icon on home page you will get a message that will say "Can Not Connect". The jail break will also disable GPS, if you have it loaded on your device and I believe in some cases text messaging..
If you go searching for a fix or patch to fix this problem you will find many ways around this problem, unfortunately, most of them are out of date and will not work. Do NOT install PushFix or PushFix 2.0, on your jail broke phone, if you do you will need to start from scratch by doing a restore through iTunes.
I found a site that has everything you need to unlock, jailbreak, then get the patch needed to get you to be able to connect to Youtube, get your GPS working, and any other issues cause by jail braking. As of the date of this writing everything is up to date and works very well. (Tip, logging into Cydia from time to time will automatically update these apps) The site gives easy to understand directions with links for everything needed to get you up and running in not time.
First step, go here to unlock and jail break your phone. Download the correct file, you will be given step by step instructions on how to jail break your phone on the page link as well as within the docs of the file. For 2g running on 3.1.3 redsn0w
For 3g or 3gs running on 3.1.3 blacksn0w
Note here, my iphone was unlocked and jail broken a few months ago. So when I went to Cydia, they had an up date, part if it was a new installer, so I had to go through this update process to continue onto the next step.
Once you are unlocked and jail broke, (Cydia updated if needed) Go here for the patch to enable Youtube and other issues unlocking and jail breaking causes. Push Doctor
At te bottom of this page under step 4 you will find some other possible useful links.
By going to those links and follow the step by step instruction you will have a fully unlocked, jail broken iphone/itouch that will work perfectly.
Just some notes on this:
When I download all the files necessary to do all this my iphone would time out or would get an error message frequently on the downloads. When this happens press OK, it will then go into reloading Data, just let it do it's thing. When this happens, go back to home then click on the Cydia icon that will be created on your device, after jail break. You will be taken back to Cydia home page and if you look at the top of your screen you will see the download is resuming, it resumes from where it timed out not from the beginning of the down load, this happened several times on my phone so be patient. I also had same problems downloading Push Doctor, as it is downloading you will see some of the packages in red, don't panic, eventually it will go into reload then ask to return to Cydia press it and will go back to the download Push Doctor page. repress install then confirm. it should resume install. If not go back home and click Cydia again, do this as many times as it takes to get the Completed at top of page. Allow some time to do this and you will end up with a perfectly working iphone/itouch with all features working, it will be well worth the time and aggravation.
Those programs I have listed above are free to download but like most any free ware it is always good to donate a few bucks to help the people who work so hard to give us these apps.