From this Apple support document http://support.apple.com/kb/ts1275
Error 1015: This error is typically caused by attempts to downgrade the iPhone, iPad, or iPod touch's software. This can occur when you attempt to restore using an older .ipsw file. Downgrading to a previous version is not supported. To resolve this issue, attempt to restore with the latest iPhone, iPad, or iPod touch software available from Apple. This error can also occur when an unauthorized modification of the iOS has occurred and you are now trying to restore to an authorized, default state. Very rarely this error is caused by a hardware issue and requires service.
This is what I did to fix the problem. My phone works fine now. I used a Windows computer to do this.
1. Download and install iOS 4.1 (You'll need to search for it - it is easy to find)
2. Download the software called "TinyUmbrella" (Please search on the internet)
3. Open iTunes, connect the iPhone throught USB
4. In iTunes, click the iPhone (on the left pane). You should be able to see the "Restore" button on the right side.
5. Press "Shift" and click restore. You'll be asked to browse the iOS ipsw (installation image). Please brows to the folder where you have saved the iOS 4.1 ipsw and select it.
6. iTunes will start installing iOS 4.1 to your iPhone and will go till the error message (1015). DO NOT CLICK OK - JUST LEAVE IT AS IT IS !!!
7. Open "TinyUmbrella". Click on the iPhone and then click "Exit Recovery' button.
You are all set !!!
Let me know if it helps - Thanks !!!