Download the 3.1.3 firmware for your device, then hold shift and click restore in itunes. A window will come up where you can choose th 3.1.3 firmware you downloaded. Then you can use jailbreakme.com or redsnow 0.9.4 to jailbreak. Guides at top of page.