I read in an Oliver Sacks book that there is a certain part of the brain which identifies things as familiar. It could be that some kinds of stimulation (or arousal like anxiety) could trigger neurons in that area.

Also, if this is something that he has seen before, he may very well have dreamed about it and forgotten until the moment that the stimulus presented itself again. That is normal.