a light bulb goes on in (one's) head
One is suddenly struck with an ingenious or inspired idea, insight, or revelation. We spent hours trying to come up with a solution, when suddenly a light bulb went on in my head. I kept feeding him subtle hints about the truth of the matter, waiting for a light bulb to go on in his head.