I have had that kind of thing happen to me as well. Awoke with what is effectively a clear path to a solution for a problem faced in prior days. Surreal for sure but exciting none the less.

One day years and years ago I was working on a process control project in assembly language for some 6502 based process controllers. Sat down that morning and was just staring at the screen. The next thing I knew it as like 1 in the afternoon. I don't remember a thing that occurred during the 5 hrs or so between point a and b, but I knew exactly how I was going to implement the interrupt driven scheduler for the project, by 8pm that evening it was done. I was astonished needless to say, and still remember that day 25 years ago, (except for those 5 hrs that I just completely zoned out).