One option...???
I've had the same issue with my MBP MacBook Pro early 2009.
Only occurred when waking up from sleep initiated by lid closure. Not sure if this applies to you (given you've said iMac)
Workaround I used was to switch off Automatically adjust brightness (Systems Preferences -> Displays).
Hasn't re-occurred since for me try that and see how you go.