I don't know if there is a technical term for this, but you know the time between when you are awake and you are really asleep? That moment just before you lose conciousness? I think there is something wacked that happens to your brain at that very moment.
A few nights ago, my dad visited me - clear as day, walked up, smile and was about to say something to me - I had a violent reaction to the vision and woke up immediately, in a daze thinking that I had really seen him. Wow.