Sounds simplistic, but I get get away from the place the bad thing happened —the office, for example—and go to to a restaurant or Starbucks or a bookstore or anyplace where I can calm myself and think through what happened and what I should do next. Disengaging from people for a while, especially the ones who are involved in the situation always helps me.