If your hard drive has successfully finished 3 different Mountain Lion installs then I would think that it is ''probably'' OK. Not the most technical answer but in my experience OS installations are usually the action that pushes a failing hard drive into failed status. Instead I would think about the HDD SATA data cable, RAM, graphics card, logic board, etc as possible failures. Don't get me wrong, it could still be the hard drive but in my opinion it seems like it's something more prone to intermittent failure since the hard drive lasted through the stress of 3 OS installs.
If I were you I would attempt to run Apple Hardware Test (AHT). Formatting the hard drive would have removed the local copy of AHT that is installed at the factory but depending on the model you may or may not be able to run AHT over the internet. This Apple support article describes this in more detail. [http://support.apple.com/kb/ht1509|Apple KB HT1509]
As far as replacing the hard drive, the majority of 3rd party (non Apple branded / flashed) hard drives will require a new temperature sensor in order to keep fan speed in check. This question had some good answers with some good info that would apply to your possible situation.
[http://www.ifixit.com/Answers/View/52868/iMac+27%22+HDD+swap+recipe|iMac 27" HDD swap recipe]
Hope that helps!