I got confused between DFU and recovery mode on the iPhone while trying to restore a custom 3.1.2 firmware.
So here's the breakdown:
To put your iPhone into recovery mode, first disconnect your iPhone from USB cable and power off your iPhone. Then hold the Home button and connect USB cable again. Keep holding the Home button until you see a dock cable pointing to the iTunes icon (or yellow triangle for older version of iPhone or Steve Job logo for pwned iPhone). Now you are in recovery mode.
Connect the phone to the USB cable and turn it off. Then hold the Home and Power buttons for 10 seconds. Then let go of the Power button but keep the Home button pressed for another 10 seconds. If done right, iTunes should start automatically and tell you that the phone is in DFU mode and that it needs to restore.
In order to restore the custom 3.1.2 firmware I had created using Pwnage Tool, I had to use Recovery mode. In principle, DFU mode should have worked as well, but I always got an error from iTunes when trying that. Recovery mode worked, though.