The Spirit Tool lets you Jailbreak iPhone 3G, iPhone 3GS that too untethered jailbreak for firmware 3.1.3 and 3.1.2.
Lookin for iPad Jailbreak? HowTo Jailbreak iPad [Spirit]
Your iPhone must be activated in order to jailbreak iPad with Spirit Jailbreak.
Jailbreak iPhone 3.1.3 with Spirit
Step 1. Update your iTunes to latest version (9.1.1), if not already.
Step 2. Run the downloaded Spirit jailbreak tool.
Note: Windows 7 users: Run Spirit in Compatibility Mode
Sit back and relax, your iPhone will reboot and some progress bar will appear. Once your iPhone reboots, Cydia icon will be available on iPhone Home screen.