Dreams exists to "copy" what you experienced that day to long term memory. Most times, you'll find similarities between what happend that day and what you dreamt about. You just replay these events, while a connexion of some sort is open to the long term memory part of your brain.
Not sleeping for several days makes your "daily" memory buffer overflow, and you start not remembering everything you did in that period. Sleeping just once undo that.
I'm actually not talking out of my ass here, but I don't have any article on hand to post