I followed the steps on
http://www.redmondpie.com/fix-itunes-1004-1015-error-and-restore-iphone-4-3gs-successfully-on-ios-4.0.1-how-to-guide/
but instead of iOS 4.0.1 there, I used iOS 4.1 because the link given to download iOS 4.0.1 didn't work and I found iOS 4.1.
Now the phone is working but...