The ever-determined band at iPhone Dev have updated their "PwnageTool" to include the 3.1.2 release of the iPhone software for iPhone 2G/3G/3GS and iPod Touch 1G/2G (note that the iPod touch 3G is NOT supported).
Jailbreaking, which is different than "unlocking", allows different applications to be run other than the ones available at the App Store, and also allows for some additional functionality such as background process for third party applications. I assume that those who are interested in jailbreaking are already familiar with it enough to know what the 'dangers' are.
For the idly curious, I highly recommend that you check out the webpage and think about whether you really need the functionality it offers. Notably, this will not allow for things like internet tethering on a carrier that doesn't officially support it. The iPhone Dev folks suggest that you remain at 3.0 until a hack for that is developed.