What you need for this is Cognitive Therapy. Cognitive Therapy might be described as logic specifically adapted to the problem of depression. It's based on the obvious cause and effect relationship between your thoughts and your mood, that how you phrase your situation to yourself as you think about it can become quite distorted in the absence of realistic thinking, leading to a miserable emotional state. It's exactly what you need to deal with specific events like the ones you mentioned that send you down emotionally.
The most widely available book on CT is called "Feeling Good" and it's by David Byrne, M.D. It sold about a gazillion copies and went through many editions so just about every library or used book store has a copy. Very easy to get a hold of.