When restoring the iPhone, if you get through Preparing the iPhone stage until you get the message on the computer saying "Waiting for iPhone" - if this lasts for as long as you leave the iphone connected, and when you disconnect it Error 9 is produced - it seems to mean that there is a problem communicating with the main processor of the iPhone - although I lack the technical knowledge to explain this properly.
Anyway, you still have a good chance to get your iphone running again, I have had this problem on a 2g 8gb that froze up, so I force rebooted and it went straight to itunes screen - it took around 30 different restore attempts using different firmware versions to get it back restored. I also have it regularly on a 3g 16gb which loves crashing and then just showing the apple logo forever, and that takes well over 50 restore attempts before it will finally take a firmware - for example it last crashed overnight on Friday, and I got it restored finally yesterday afternoon.
What you need to do is set the iphone off restoring in iTunes (USE the DFU instructions above - DFU seems to work much better), if it says waiting for iphone still when the bar on the iphone gets beyond half way along put the iphone into DFU again (just grab it, hold top and home buttons till it shuts off. Release the buttons, then hold home and power buttons again for 10 seconds, release power button and wait for it to appear in iTunes). I don't know if it helps or not, but I tend to vary the firmware files I am using, if nothing else it makes the process a little less boring, download different firwares from here:-
iPod and iPhone Firmware Download
Keep trying, if there is no bar on the iphone for the firmware you are using - then if it hasn't got beyond Waiting for iPhone after 5 minutes then it won't at all so start again.
I can't work out what makes it finally take, maybe all the reboots and putting in DFU mode, maybe it just does it when it feels like it. On my 3g 16gb I took the MOBO out to see if disconnecting the battery power would help, but it had no affect. So you are stuck with just keeping on trying to restore it, and hope that one time it will take the firmware. I can't guarantee it will work, but it's worth trying - and post back if you do get it running!