By artificially activating circuits in the brain, scientists have turned negative memories into positive ones.
They gave mice bad memories of a place, then made them good - or vice versa - without ever returning to that place.
Neurons storing the "place" memory were re-activated in a different emotional context, modifying the association.
Applying this technique to traumatic human memories appears unlikely, but the work sheds new light on precisely how emotional memories form and change.
The research is published in the journal Nature.
"Emotion is intimately associated with memories of past events and episodes, and yet the 'valence' - the emotional value of the memories - is malleable," said the study's senior author Prof Susumu Tonegawa, from the Riken-MIT Center for Neural Circuit Genetics in Massachusetts, US.
He offered examples of a mugging, or a blissful holiday, which might make you fearful of a particular street, or fond of a beach.
We all know that these sorts of emotional associations can be changed by a new, contrasting experience. Your favourite seaside memories, for example, might be soured by news of a shark attack.
Therapists already use this malleability in their efforts to treat trauma victims or people with depression, attempting to replace negative associations with positive ones.
Prof Tonegawa's team has unpicked some of the networks that make this happen inside the brain.
Two years ago, they showed they could label the cells storing a new, fearful memory in a mouse's brain, and turn them on again at a later date to cause fearful behaviour.
Then in 2013, they labelled a memory of a place and later reactivated it, while giving the mice small electric shocks. This created a false, fearful association with the original place.
Now they have managed to actually switch the emotional, fearful - or cheerful - content of a memory, from one extreme to the other.
Male mice were given a negative experience, consisting of small electric shocks, in a particular room, and the neurons working to store that memory were labelled using "optogenetics".
This is a technique that effectively installs a switch in those neurons, allowing them to be turned on again at will. The trigger used to stimulate them is a beam of blue light, sent into the brain by an optical fibre.
The next day, with the mouse in a different room, stimulating the labelled neurons in this way effectively "reactivated" the original, fearful memory. When the mice were offered a choice between having the blue light on or off, they chose to leave it off.
But next, the researchers stimulated the labelled neurons while they gave the mouse a positive emotional cue (a female for company), in an attempt to "flip" the emotional association of the stored memory.
Sure enough, offered the same choice again, the mice now wanted the blue light switched on: the original memory trace had been altered, and now they liked it.
Importantly, when returned to the original room, in the absence of any brain stimulation, the mice were less afraid than after the first round of training. Their memory of that place had changed - for the better.
The whole procedure also worked in the other direction, allowing the researchers to engineer a corresponding flip from an original positive memory to an artificial negative one.
By installing the optogenetic switches in different parts of the brain, the team also established that the memory changes came with adjustments in the connections between the hippocampus, which stores spatial information, and the amygdala, which drives emotional responses.
The scientists now believe that a place memory, stored in brain cells of the hippocampus, can "call up" different sets of neurons in the amygdala, invoking either good or bad emotions - and their experiments tweaked that wiring, so that the original memory produced an altered emotional response.
"We changed the way the mice react to a memory, without any drugs," said Dr Roger Redondo, one of Prof Tonegawa's colleagues and the paper's first author.
Importantly, he added, "[This] occurs without the mice ever being brought back to the original place where the memory was formed. All the manipulation is done from within the brain."
Of mice and men
It is difficult to know, however, whether the artificial recollections, driven by beams of blue light inside a mouse's brain, are similar to memories as we know them.
"We can't ask the mouse what it's thinking," commented Prof Richard Morris, an eminent memory researcher from the University of Edinburgh who was not involved in the study.
"All we can do is ask the mouse: If I turn this light on, how are you going to behave in relation to whatever gets evoked?"
Prof Tonegawa also points to the consistent behaviour seen in his team's results. "The mouse is obviously expressing the consequences of recall in its behaviour - so therefore, we assume that the mouse has the sensation of recall."
In terms of whether their findings can be directly applied to humans, the researchers are cautious.
"There may be a few years of work ahead, but you never know," said Dr Redondo. "Technology is moving faster and these optogenetic tools keep advancing."
Prof Morris agreed that this was something of a long shot - but he told BBC Science In Action the work was valuable nonetheless.
"Nobody's going to be queuing up to have light guides inserted into their brain and have blue light shone down into it.
"But [these results will] help us understand the proportion of cells that are involved when you have to change a memory from being a bad one into a good one - are we dealing with changing 50% of the cells in the amygdala, or are we dealing with 1% or even less?
"It gives us an idea of the scale of the problem.
"I think that's valuable, that's important - to move beyond just a behavioural understanding, but to have a deeper understanding of the clinical task in front of us."
Follow Jonathan on Twitter.