Berkeley researchers discovered that during REM sleep the brain processes emotional experiences and takes the painful edge off difficult memories.
The findings offer a compelling explanation for why people with post-traumatic stress disorder (PTSD), such as war veterans, have a hard time recovering from painful experiences and suffer reoccurring nightmares.
They also offer clues into why we dream.
http://www.psychcentral.com/news/2011/11/25/dreams-help-heal-painful-memories/31862.html