If you had your 3GS or iPod touch 2G unlocked / jailbreaked on firmware 3.00 or 3.01, you can happily use the Pwnage tool v3.1.3 (for Mac only) by the dev team to upgrade to firmware 3.1. You need to build a custom .ipsw file using the pwnage tool before you upgrade.
Unfortunately, iPhone 3Gs or iPod Touch running v3.1 are not supported out of the box. That puts the iPod Touch 3G out of question aswell. More details here.
You can download the original .ipsw file for your iPod touch / iPhone at our download page.
Also, see details unlock iPhone 3G or 2G using Pwnage tool