Yup, I've done it to my 3G.
go to http://www.iclarified.com/entry/index.php?enid=750 and find the OS you want( iPhone1,2_3.1.3_7E18_Restore.ipsw is what you asked for)
then go here and download RecBoot (http://www.sebby.net/443-recboot-final-release/), this will put your iPhone into DFU mode, but you need this program because at the end of the process, you are going to get an Error pop up, this program will take it out of Recovery Mode.
and here is a video tutorial detailing How-to. http://cnettv.cnet.com/downgrade-your-iphone-3g-from-ios-4/9742-1_53-50090954.html
its super easy. But this process only works for the iPhone 3G (not for the 3GS or iPhone 4)
I did this with my iPhone 3G because it made my phone extremely slow and it was definitely not a good selling point. If you don't want to mess with downgrading, just wait for Apple to release a non-buggy 4.0, whenever that will be no one knows.