I was reading the comments trying to find something similar to this. I remember reading a similar explanation. The brain in a ultimate attempt of solving that fatal situation goes deeply thought memories to find anything that could help. Evolutionarily, this would make sense.