Apple released iPhone and iPod firmware version 3.1.3. The release came just one day after the release of redsn0w 0.9.2 by iPhone dev team.
Note that only iPhone 2G users can use existing redsn0w to jailbreak and unlock. For a step by step guide, follow this link: Unlock iPhone using redsn0w
iPhone 3G, 3GS and iPod users should not upgrade at this point. You can loose unlock, possibly forever.
Here are the direct download links:
iPhone 3GS: Download
iPhone 3G: Download
iPhone 2G: Download