I'm mostly just joining the choir here, but what the heck.

In the first situation, it feels like a bad response to a bad decision. Your party got savaged because this player was being a dink, so you responded by being a dink right back at him so that your party wouldn't suffer alone. This had the exact effect I would have expected - the player you stabbed didn't learn not to be a dink, he learned that the next time he wants to be a dink he should kill you first. This in turn makes the whole game experience worse, and I fully expect that in the long run we're going to get another story from you about how the second set of characters all died when this player escalated the situation again.

In the second situation, you did something bad, the player you did it to do something worse, and the DM did the worst of all. No matter how I parse it, I read this as "the DM didn't want to keep dealing with the player's character, but knew that the player would be extremely unhappy with losing them, and so tried to foist the responsibility and consequences off onto you. They then succeeded, and having been tricked into taking the consequences, you subsequently left the group, allowing the DM to reap the spoils of their conflict-averse decision."

I think that, from your description, you handled the situation about as badly as it is possible to have done so - being flippant about something that was very emotionally important to the person you hurt, and then being defensively flippant when other people tried to call you on that. At the same time, you were also in a no-win situation where handling the situation well was probably impossible, and I can understand reacting poorly to other people's poor decisions.