I'm sure it has happened to many of us.
You go to sleep, then enter dreamland. The dream is so vivid that you don't wanna wake up (in the case of nightmares, it's subjective, really) . Usually when that thought enters your head, you are lulled back into a blurry reality. You quickly try to go back to sleep, usually failing miserably.
Then you spend quite some time going over the dream again and again over in your head, without much success cuz you've forgotten it the moment you wake up.
Of course, some studies have shown that actually one only dreams when the body is not at a complete rest.
Those champion who can sleep through the whole night are a lucky bunch.