"Tragedy + Time = Comedy" - Woody Allen
Sometimes you simply have to weather the storm. It's impossible to stay happy all of the time. When I get blindsided the first thing I tell myself is; "This time next year you will be laughing at this."
That statement alone takes me from (present tense) to imagining a (future) beyond the mood or pain I feel right now. It's my way of reminding myself that (this) is temporary.
The next thing I do is take a "mental vacation". Unplug from TV, phones, laptop, and social media. Go to the gym and work out while listening to music from my iPod. Afterwards I might treat myself to a favorite food or go check out a movie alone. (preferably a comedy or escapism type of movie).
When I get home I read an uplifting book or positive motivation book until I dose off to sleep. Odds are once you wake up you'll be able to plan how you want to move forward one step at a time.
Taking action is the only cure I know of for depression. However before most of us can do that we need a "time out". That is where the gym, a walk, listening to music, going to see a movie, and taking a nap come into play. It's important to put things in perspective by realizing whatever you're going through is just a slice of your life and not the whole cake.