I'd open up activity monitor and check CPU usage, memory available for use, and see if any apps are hogging stuff up. It could be a hard drive going bad, but it could also be excessive swapping. If it can't be tied to a process, memory over consumption, or an over active process, then I'd look at the drive.
I made my first post today because my hard drive died (2006 iMac) and I'm considering replacing it with an SSD. We used Scannerz to test it because it can detect system problems as well as drive problems. In your case, it sounds like a true drive problem (in fact, it sounds almost exactly like what was going on with mine). They have an interesting video that shows two different problems - one is a hard drive that's bad and another is a system with a faulty cable. Both can act alike but they produce totally different test results.
A link to the movie is here:
http://www.scsc-online.com/Videos.html
Start up or download the "Advanced Features Video" and once it loads, fast forward over all the crap about the logging window, preferences, and drive probing and go to the part where they compare a true hard drive problem with a cable problem. A lot of problems can act like drive problems when they're not. If you're in the US, they do offer tech support at no cost. I personally wouldn't bother with their "Lite" version of the product because all I think it does is give someone a pass/fail so they can take their system to someone to get it fixed. It's only benefit is it's cheap, as far as I can tell.
If it is the hard drive, check and make sure your unit isn't one of those "special" iMacs made a few years ago. "Special" in this case means it will only take a certain type of drive (maybe someone else can chime in on this...I don't remember the details).