I too have come up with some of my best solutions in my sleep. Once, when working on a database to develop work hour tracking for a university with 9 differently regulated programs I was literally dreaming in code...about a field of sheep (well better dreaming them then counting them...)- each object had its own individual code and the overall "picture" summarized a solution for a problem I'd run into.
I've also found that just getting up and walking away (literally or figuratively) can do wonders - the problem percolates as you take a walk, work on a simpler problem, ruminate on your belly button, or whatever. Then the "ah-ha" moment comes - there have been times when I was surprised that a little light bulb didn't literally appear over my head.
Keep Up with TechRepublic