A group of US researchers believe they have found the gene which performs the role of memory extinction.
The process, which occurs when new memories overwrite old ones, is being treated as the key to eventually being able completely to delete painful memories.
The research could lead to medical advances and the successful treatment of those suffering from post-traumatic stress disorder or sufferers tormented by earlier experiences.
Scientists at Massachusetts Institute of Technology who conducted the study say that if a way can be found to amplify the activity of the gene, known as Tet1, it could change lives.
The research echoes the 2004 Jim Carrey and Kate Winslet film, Eternal Sunshine Of The Spotless Mind in which memories are wiped.
As part of their study, the researchers compared learning behaviour of mice with the Tet1 to mice who had their version of the gene inhibited, or as the scientists put it, "knocked out".
Both sets were trained to fear a certain cage by giving them a mild electric shock each time they were placed inside.
Mice whose Tet1 was "knocked out" learned to associate the cage with the shock, just like the normal mice, but when the researchers put the mice back in the same cage without delivering the shock, the two groups behaved differently.
To the astonishment of scientists, mice with the Tet1 gene did not fear the cage, because their memory of being hurt had already been replaced by new information.
But the knockout mice, whose memories were not replaced, were still traumatised by the experience.
Li-Huei Tsai, director of MIT's Picower Institute for Learning and Memory, said: "If there is a way to significantly boost the expression of these genes, then extinction learning is going to be much more active."