Bad memories can be beneficial. They remind people not to eat the foods they don't like and not to drop heavy things on their toes. But a lot of bad memories stick around and do nothing more than torment the sufferer.
When embarrassment or tragedy is felt, the neurotransmitter norepinephrine is released and memories are formed that may not easily fade away. Memories based on humiliation are often replayed over and over in a person's mind in an attempt to see ways that the situation could have been prevented or improved. Oftentimes the situation itself becomes much larger and the need to prevent it from ever happening again becomes overwhelming.
Dr. Ashok Hegde of Wake Forest University Baptist Medical Center is working toward selectively blocking memories that are part of PTSD or simply hurting a person so much that their personality is affected. In the meantime, it's important to forgive yourself for what happened, to realize almost no one remembers your most embarassing moment (because they're too focused on their own), and to move on, as difficult as that may seem.
For more info: MSNBC article