Hardware vs Software
If your Mac came with a hardware test CD, you can boot from that and run tests on your graphics card, among many other things.
It could be hardware, or it could be corrupted graphics system drivers (from that original crash). Try downloading and installing the 10.5.7 Combo Update over your current install (Backup first, of course), which should replace any damaged System files. If it's still doing the same, I'd look to hardware.
If you take your iMac in, be sure you back your machine up first, as if your graphics card is damaged they may well replace your entire machine instead of tearing it apart to get to the graphics card, which tend to not be too serviceable. Even if they do just replace the part, they may do a fresh install on the HD to rule out any software issues.
Hardware Specs: 27" i5 Intel iMac w/4Gb RAM running Mac OSX 10.6.4 SnowLeopard.