Hello,
I am currently on my third 27" i5 iMac due to similar issues. The first one that I had made the exact noise that you are describing. I noticed it when the display was either dim, below 50% brightness, or off, and the noise persisted even if the computer was shut down. I called AppleCare, they organized a replacement for me. The second and third iMacs have had a very similar problem, only in reverse. On these past two, when the brightness is above 50%, I hear the buzzing and a high-pitched dog whistle noise coming from the upper left corner of the screen (it is most audible near the back vent for obvious reasons). I have been in contact with a senior advisor, and he just heard back from the engineers today. They have determined that it has something to do with the cable running from the power supply to the backlight, or the backlight itself. This iMac is going back, and I am opting for a refund and waiting until the next refresh to re-purchase it. I am just to the point where I think the issue is more widespread than anyone really realizes, and I don't think that another replacement is going to solve the problem.
My advice is to get in touch with Apple Care and get it diagnosed. Whether you choose to opt for a replacement or refund, well... the ball is in your court.
Please try to report back here on this thread if you get any more information from Apple Care regarding this issue.