Glad to see I'm not the only one to feel like this!
Sometimes when I'm working on something really hard I purposely go to sleep in order to keep thinking about the issue in my half-sleep, when the limit between conscious and unconscious thought starts to fade.
Then more often than not I wake up with an uncontrollable urge to implement a crazy solution that often happens to work.
I believe the credit is still mine, and the mind works in mysterious ways.