Today I got the electric shock from my iPhone 3gs connected to my iMac. Exact same scenario for me too. I have felt minor static around the metal edges of iMac but did not bother about it much till date as I have seen similar thing on Macbook Pro as well.
Today, after connecting my iPhone, I just picked it up accidently touching the metal surface near the docking port. OMG, i did not realize what happened, I just dropped the phone on the table and shook my hands. Then realized what happened.
I was too scared to touch anything then and quickly grabbed a tester and placed it on the metal edge near the docking port (the cable remained connected) of my iPhone 3gs. The tester was glowing. I then I shut down the iMac (thanks to wireless keyboard and mouse). Tried it again, samething. Weird. Why would there be a voltage on the USB ports when the **** machine is shut down? This stayed on for nearly 5 mts. I checked all the connections, then plugged everything back again. Now it is gone. However, I am scared to touch iMac until Apple engineer walks down to my place and says everything is fine.
Definitely it is not a static and at the same time, it is not as bad as the ones from the power socket, but it is something serious to be taken up with Apple. I called them up and they have registered my case. The support engineer asked me a lot of questions:
1. Are there any injuries or property damage? I said No. (Good!)
2. Any cable burn outs, fumes or fire or any funny electric smell? I said No
3. How long was this static problem I faced (nearly two weeks or so)
4. How long this voltage problem stayed on (i said 5 mts and I kept testing it using the tester)
Finally he said, it would take 4 business days.
I also told them that now things seems a normal (I am typing it on my iMac with needless to say the tester is next to me). I will keep you guys posted on this.