I was stuck on a coding problem for the entire afternoon one day. For whatever reason things weren't clicking and I couldn't solve the problem I had. I went to bed and as I was waking up the next morning, the complete solution came to me.
I wasn't dreaming, but I was in that hazy half-awake half-asleep mode where I'm not consciously thinking about anything.
I've had this happen a few times before where I go to bed stuck on a problem and miraculously wake up with the solution. It's a very strange (but happy) feeling.