Jailbreakers ahoy! Yesterday brought the release of the Dev Team's pwnage tool for jailbreaking and unlocking iPhones equipped with the new 3.1.3 firmware. As usual, though, there are a few catches: first, if you don't need to update to 3.1.3, the dev team says you shouldn't bother anyway -- it doesn't do much that the old versions of the firmware doesn't, so if you don't need to upgrade, just leave your jailbreak as is.
3G and 3GS users especially should be leery of this one, since if a mistake is made, there's a chance you could upgrade your firmware and then not be able to unlock it again. They also have all sorts of other warnings and exceptions on their blog post. As they say, don't download and run those files without seriously thinking about what you're doing with your iPhone.
If, after all of that thinking, you decide it is time to crack open your iPhone with the 3.1.3 firmware, the jailbreak will put together a custom 3.1.3 IPSW for you to restore back on to your iPhone -- here's a quick how-to to start with. Good luck, and be careful out there!