A step by step demonstration of jail breaking and unlocking both your iPhone and iPhone 3G. To do this you'll need redsn0w version 0.8, the firmware needed for your iPhone and for the first generation iPhone you will need a boot loader. Oppen redsn0w and find the firmware for your iPhone. Once the IPSW is successfully identified you will need to install Cydia. For the first generation iPhone there is an unlock option and this is where you'll need the boot loader to unlock and viola you're done!
For the iPhone 3G you will need to turn it off and hold the home and power buttons to begin the download. Once it restarts you'll use Cydia to install the source, repo666.ulrtasnow.com. Once the iPhone restarts it should be unlocked!