Second monitor on iMac not working with Lion
As it turns out, it was the Mini DisplayPort-to-HDMI cable. I connected the secondary monitor with a Mini DisplayPort-to-HDMI Adapter and everything works fine.

To the best of my knowledge, the cable is fine, although, apparently, it is an unlicensed HDMI cable, and manufacturers can no longer sell them. Has Apple dropped support for these? Not sure. At least everything works again.