https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4670291/
Many related articles
Not sure about the actual mechanisms, but the idea of these kind of influences on individual memory formation is intriguing.
After all, it's hacker news :)
A pet hypothesis of mine is that maybe some of the brain chemicals act like an extra input to the neural network, and can be associated with various behaviors or memories. Lets say there are 5 of them which would create a 5 dimensional "chemical space" you're operating in. Certain things can be remembered and associated with regions in this space. Being anxious, depressed, afraid, or whatever could be temporarily "cured" by shifting you out of the current region in this space. Which chemicals work would depend on your specific programming. This might explain people who have a fear response to positive emotional situations (they were traumatized by someone that otherwise gave them positive emotions that release certain chemicals). Just a weird hypothesis - I bet it's been researched but I haven't looked.
Edit: One of the other responses to the parent post provided this: