Have had a nightmare of a time restoring an old iPhone 5 to factory settings. It's been out of regular use for 18 months and I just started letting my toddler play around with it. I should have deleted the passcode ages ago. Upon receiving "iPhone disabled, connect to iTunes" I did just that, only it wouldn't sync to iTunes.
By unplugging the phone, doing a hard reset, then continuing to hold the HOME button, I reconnected the USB cable already connected to the computer (with iTunes open). As the phone turned back on, iTunes finally recognised the device needed updating and restoring. Unfortunately after several attempts to simply update software and restore from iTunes failed, it eventually downloaded the software (this also took several attempts as the iPhone kept disconnecting from iTunes and the whole process would pause and fail to restart).
Once the newest software was downloaded in iTunes, it attempted to extract software from the iPhone and restore to factory settings. This also failed and an error message came up saying "this iPhone cannot be restored to factory settings. (Error 47)"
I waited a few minutes, frustrated to the max, then did the same thing by disconnecting the phone then holding the buttons as though doing another hard reset, holding the home button and reconnecting the cable. Once again it kicked into action and began restoring the phone...and this time it all went through ok.
During this process, that msg that had originally told me my phone was disabled and needed connecting to iTunes, disappeared and the screen would only go to black, with the apple logo coming up if I held any button down. It definitely seemed as though I'd never get it up and running again.
But it's completed. The old iPhone 5 is back to square one.
I've read all the previous replies about heating some chip. I wouldn't know the first thing about that and am glad perseverance worked in my case! Took a few hours of repeatedly trying, though. Hopefully time and patience will work for someone else :) good luck!