Taking all the warnings into account about losing these tiny screws, during removal and replacement I held onto the screws tightly with a very fine needle nose tweezer. Fortunately I managed not to lose them either out or in. I highly recommend using a small gripper during this step.
I replaced the original 320 GB OEM Apple/Hitachi drive in my 2007 iMac with a 3 TB Hitachi/HGST drive today using the iFixit guide. To reinstall OS X, I used an Apple USB thumb drive, which after reformatting with Disk Utility, is currently downloading Lion from Apple. I also decided to run the formatting/reinstallation before reassembling the front bezel and glass, in case my son and I did something wrong in the drive replacement. Fortunately it looks like we did everything right.
As robgendreau says, avoid this whole step by opening the bezel and laying it upside down above the iMac, still connected by the mic cord, just carefully. Then replace the battery, suck/blow out your dust, and carefully rotate the front bezel back over the iMac from where you removed it. No cord manipulation or damage at all!
Mine did not reset to 2004, or else reset itself correctly later before I looked at the date.