Yes, of course, It happens, you may find the answers to many problematic issues while you are sleeping. One advice is after you become conscious or awaked for any reason "Write it directly" then complete your sleep session.
Additionally, The following links may provide some help about the mechanism