I see it’s been a while since this question was asked, but I thought I’d add my testing / solution.
I have a spare 27” Apple Display that’s maybe 5-6 years old. I had read something on another blog to test the built-in monitor by attaching an external monitor to see if the flickering continued.
When I attached the '''second monitor,''' it continued flickering. I went in to play with the monitor setting and when I changed the settings to '''“Mirror Display,”''' the flickering went away. As soon as I set the monitors to continuous, the flickering came back. It’s 100% repeatable (every time I set the monitors to mirror, the flickering goes away.
I’m going to test it with a smaller monitor as soon as I get a Thunderbolt to DVI adapter.
Good luck and hope this works for you.