I've seen a few instances in which cheating seems to have been the right -- or at least the best -- course of action given the circumstances. But the one that most comes to mind involved a friend of mine.
His wife cheated on him. He told me that when he found out, he at first felt relieved -- because the two of them were sorely mismatched but emotionally clinging and he was unable to end their loveless marriage from a misplaced sense of duty. After three days of feeling relief, he started to second guess his feelings, and by dwelling on the negatives, he managed to plunge himself into a depression. The depression lasted six months.
It ended one morning when he woke up spontaneously happy. He realized that he was free of a horrible marriage -- but one he never would have willingly left because of his sense of duty. This time around, he was not foolish enough to second guess his feelings, and he says he's felt grateful to his ex-wife ever since that morning.
There seem to be legitimate exceptions to the prohibition against killing your fellow humans. How much more so are there likely to be legitimate exceptions to the prohibition against cheating on your partner.
Here's my problem with this whole thread's premise:
As self-centered humans, we can usually find a way to justify just about anything we do. And even tragic events in our lives can have (eventually) good outcomes. But that doesn't relieve us of our responsibilities to others, including maintaining our integrity in our relationships.
The thing is, when we cheat, we DON'T know that it won't hurt anyone, no matter how much we tell ourselves it won't. We DON'T know whether or not our partner will find out. We DON'T know whether we may contract a disease, or become a party to a pregnancy, or destroy a family.
The risk we subject others to is in many ways just as wrong as the adultery itself.
Sure - we can all come up with scenarios of cheating which have "happy endings." Heck, my ex husband cheated on me, and if I hadn't caught him and divorced him, I wouldn't be married now to a terrific person who is truly my soulmate. That still doesn't justify what he did or make it right or OK.
As for your friend, you are saying that he second guessed his feelings, and "managed to plunge himself into a depression." Having been there - bad marriage, then a cheating spouse whose actions finally pushed me to divorce him, I can assure you that in spite of the GREAT relief one can feel from finally leaving a bad marriage, the fact that your spouse committed adultery is still incredibly painful. I would say that his depression was a perfectly normal response to a very sad situation. He didn't do it to himself - his cheating wife is who is responsible for his grief.