The way that thoughts are linked is the same way that I believe dreams are linked to waking thoughts.

The connection could be something more kinetic or olfactory than visual. olfactory is actually the sense most linked to memory. It could also be an unconscious thing the same unconscious process going on in the background. Maybe something visual that you don't notice like going from a dark room to a light room and last time that happened was in the dream. Maybe there is an unconscious process that resets every hour and a half while conscious as well as unconscious and as it goes through that process it unconsciously connects those memories of the last time and when you remember what happened an hour and a half ago or three hours ago it comes as a shock to your conscious and it pulls it up.

There are a lot of reasons that we know that we remember dreams and other things we can only speculate. A good sign of good recall is that you notice the transition from sleeping to waking. You remember your dream because you were just there five seconds ago!