Today we are going to cover how to successfully downgrade the iPhone from OS 4 beta (iPhone 4.0) back to iPhone 3.1.3. If you're a small developer who installed the iPhone OS 4 beta then realized you had to troubleshoot problems for an existing app under 3.1, it can sometimes come down to this or having to quickly go shopping for a second iPhone or iPod touch. Luckily, downgrading can be done pretty easily a majority of the time, even though things sometimes go downhill, like DFU loops, errors, etc.. We will cover these scenarios right now and hopefully get a lot of people where they need to be. I'll show you two ways to downgrade, through XCode (Mac only) and through iTunes (Mac and PC).
And as always, if you are even a little scared you may mess up your phone during this process, stop right now. What you do to your phone is always on you. These guides are there for your convenience, but we hold no responsibility for any bricked iDevices of any kind.
If that didn't scare the pants off of you, hit the jump for screenshots, a written walk-through, and a video!