I updated "by mistake" to iOS 4.0.2, what do I do now?

If out of curiosity or by mistake you updated to iOS 4.0.2, then only there is currently no jailbreak solution, regardless of the terminal you own iPhone 3G/iPod Touch 2G can be jailbroken with redsn0w 0.9.5 beta 5-5. However, if you have saved SHSH in Cydia/PC then you have a chance to return to iOS 4.0/4.0.1/3.x and jailbreak with the jailbreak solution from jailbreakme.com, or your favorite utility.

If you have an iPhone 3G/3GS, you have SHSH saved in Cydia and you want to return to iOS 4.x, then you must follow this tutorial, ignoring the firmware versions specified there because the tutorial works for any firmware that has SHSH saved in Cydia . For iPhone 4 this process does not always work because iTunes gives certain errors, I will come back with a tutorial for iPhone 4 as well.

If you have SHSH saved in your PC with TinyUmbrella then all you have to do is connect your phone to the PC, open TinyUmbrella and press the "Start TSS Server" button, then open iTunes and restore to the desired firmware version.

If you have an iPhone 3G, it is not necessary to use SHSH if you want to go back to firmware 3.x, but if you want to go back to iOS 4.x then you need SHSH, if you don't have it you can't restore.

If you receive the error "this iPhone is not eligible..." then you did the wrong tutorial, you skipped a step, and you have to redo everything because iTunes does not connect to the Cydia server. If you get error 3194 then you do NOT have SHSH saved for that version of iOS and you are struggling for nothing.