Lightening the mood is my normal go-to, but last night my wife was on a roll and I knew stepping in would just escalate things. I was able to send my daughter on an errand and then told my wife to take her frustration out on me.
It wasn't immediate, but she calmed down and eventually apologized to our daughter for being harsh.
She normally has the heavier disciplinary hand, but I get to be the parent that puts the foot down when things get real.
BOOM!...there you go, cooler...in the end, the key is knowing the person, understanding what paths create what responses and building a relationship of trust that no matter what, the other person has your best interests in mind. Now, sometimes...to use an old cliche...to make an omelette, you have to break a few eggs, so sometimes we try the wrong path, but that's where having the other person trust that no matter that we just stepped on our ****, we were trying to help will smooth over those bumps.
Admittedly, it's not a marriage relationship, but the best example I can think of is a co-worker who tends to get riled up about small/odd things (I know, ironic me saying that considering my rants last night), and just lets them eat at him for a long time, and he becomes a bearcat to interact with...doing what you talked about (taking it out on others) in spades. When we first started interacting, I tried calming him down, and it didn't work. Ultimately, I got annoyed by it, and so when he'd get that way, I'd push his buttons mercilessly so that he'd avoid me until he calmed down. That was before he trusted I was 'safe' and only wanted the team to succeed. Now, when he gets ginned up, I'll push a button, he'll look at me with this very short flash of rage and "I can't believe you're not on my side here", then he thinks, realizes I'm never not on his side (well, clearly we have disagreements but we don't get personal, we work thru them), and then he most of the time laughs, says "you ***hole" and starts calming himself down.