when your iphone is plugged in, and it shows up in itunes, press the 'restore' button while holding down the option key. this will allow you to manually look for and choose the firmware you want to use (ios4.0 or ios4.0.1).
the firmware will be in 'user'/library/itunes/iphone software update
so if you had problems updating to 4.0.1, just restore using 4.0 firmware and i guess try again.
oh i forgot to ask... are you on windows or mac system?