I remember reading once that Salvador Dali had a unique setup to gain inspiration: He sat upright in a chair, his hands hanging down. Under one hand, he had a plate, and in that hand, a key. He would nod off, and when the key hit the plate, he would wake up and drew what he saw in his near dreaming state.
Apocryphal or not, it's a neat story. And I can say that I myself have frequently pulled inspiration for stories from dreams.
Sometimes, for a story, dreaming is better than thinking. Thinking, you might try to force ideas together, like puzzle pieces that don't fit. Dreaming, things drift around and brush against one another, and even though dreams frequently don't seem to make any sort of coherent sense, there tends to be a nugget of truth or usefulness in them.
While dreaming, you are transported. Sometimes, you might dream a memory. Sometimes you might dream the future, or a possible future. Sometimes you dream your entire work or school day, and then have to wake up and do it again.
Dreams are a sort of subconscious stew. In general, the most memorable dreams, and the most real, happen during REM (rapid eye movement) sleep. Though science hasn't yet agreed on the actual use of REM sleep, it is a facet of restful sleep, and we all have notions of the horrible effects that sleep deprivation have.
So, dream on. Keep a dream journal, whether it be to gain insight in your daily life and inner psyche, or whether to mine your sleeping mind for story ideas. Equally valid approaches, in my opinion.