First off, something this big should be handled in the group's social contract. At what point is PVP allowed?
An example from my experience:
I played a very blunt human in a D&D campaign and butted heads with an elven Bladesinger. Basically the party was mostly elves and when one would do something foolish, my character would make a joke at that character's expense. Of course, the bladesinger got increasingly offended at this. It kept escalating until swords came out.
First, talk it out
The first thing that should happen is to let the two players/characters talk out their differences. This is likely to be a long process. I suspect your characters have long since passed this point.
Next, let the argument happen
Once talking fails to persuade, someone's going to start yelling. First off, as GM you can cool the argument a bit by letting a wandering monster hear the ruckus and come to investigate. Especially if the "wandering monster" is a group of bandits. People yelling and arguing are likely to not hear them sneaking up for the PC's valuables (and this gem sounds like something that will intrigue many bandits). This is a delicate balance for the GM, you want the PCs to argue and express themselves but if the rest of the group looks bored it may be time for something to happen. Don't immunize the players from the consequences of their own actions, even if it is yelling. After either a fight, or the bandits get away with the loot and the PCs track it down (and fight for it); hopefully cooler heads can prevail regarding what to do with the gem. If not:
FIGHT!
I am not sure what is in your group's stated or implied social contract. However, PvP (player v. player) is not allowed at all. Period. However, PC v PC can be allowed as long as both players understand that it is the two characters brawling. My group is a little laid back on using both player name and character name at the table. However PCvPC is an exception to this rule. Only refer to character names while the fight is going on, this helps to reinforce that it is the characters fighting and the players are acting in a dramatic scene.
Once the fight ends, the first thing both players need do is to shake hands, then one or both should leave the table for a few minutes. A bathroom/snack break is a great thing to do at this point. If both players are pros at this, they realize it was CvC and not PvP, if there was a bit of frustration (especially for the loser of the fight), this break lets the player cool down a bit and regain balance.
Aftermath
In my case, after we fought we both got winded/knocked down and were laying next to each other on the ground, and I then said in character, "I was not criticizing all of Elvendom, nor disrespecting [a third character]. I was commenting that a noble character was doing a foolish action." The other player's character then told me why he took offense was because "What a moron" was interpreted as disrespecting the entire race and the character specifically. As we got up, we recovered our gear and made a few snippy "parting shot" style comments that clearly was not nearly as heated as before the fight.
Your two characters may have a series of conflicts over this gem, or maybe one fight which proves to the both that both are resolved in their opinion. And that is a starting point to some great dramatic discussions and roleplaying, IMHO.
Or not...
However, if your players are not comfortable with PCvPC and it is established in the social contract, then let matters go as far as they can, and when hand touches sword, DM you need to yell "BREAK" or "CUT" or something to stop everything right there. Player's tempers may flare in an argument, but the DM is also the referee in terms of not only the game's rules, but also the group's social contract.
I'd suggest you put yourself in their shoes. For a better understanding of how they feel, imagine the game as a movie with their character as the hero.
In a movie, if the hero heroically struggles with evil and some bystander steps up and kills it when it was almost defeated by the hero, would you think that's a fun scene? Would you want more scenes like that in the movie?
Chances are, your answer is "no". Their answer seems to be "no". The relative rarity of movies that work this way implies a majority of people does not like this, even though mechanically, the audience does not get anything from the scene, no XP, no money, they just take away how it felt. And it did not feel good.
I think they may feel cheated?
They probably do. They put in effort and risk and it seems the reward for it is claimed by others that did not put in either. The reward might well be that feeling, not loot or XP.
In the three scenes you described, was there any reason for them not to be the hero? Why did the NPC step up all of a sudden when the plan was for the fighter to hold and the others to go for another goal? Why did the PC "walk up" leisurely to deliver the killing blow in the middle of a chaotic fight? Why the hellish rebuke trap? What was it good for, other than to steal his heroic ending of the scene?
In real teamwork, the others share the risk. All fight and by random chance one will get the killing blow. If all share the risk, then it's teamwork. If only they are at risk, then they should get the good feeling of having overcome it.
As a player, I'm not really sure how this should be handled.
66% of your mentioned examples are DM made, so I'm not sure if this is something that can be handled by a player alone. Talk to the group as a whole, including the GM. Maybe do the same exercise, let them imagine the scenes as a movie and ask them if they would want to watch it.
Best Answer
Games should be fun. This DM is making it not-fun for you. Quitting was the right thing to do!
As for the "sore loser" comment, either one of two things may be happening:
For whatever reason, they were deliberately tormenting you. Calling you a "sore loser" is an attempt to manipulate you back into their control, so they can keep tormenting you.
They were making it hard on you unconsciously, and you quitting confronted them with the possibility that they were DMing badly. Since we humans, psychologically speaking, tend to conflate being bad at something with being a bad person, and we're indisposed to think badly of ourselves, we tend to try to explain problems by blaming other people first. So instead of admitting to himself that he's DMing badly, he decides that the problem must be with you and that lets him keep feeling like a good DM and a good person.
There is no difference between the first and the second in terms of your enjoyment of the game, so quitting is still the right thing to do regardless of which is the case.
The difference between the two is much more important at the group social level and the friendship level.
Because you don't know whether it was malicious, or whether it was a mistake that he's just having trouble owning, you are better off giving him the benefit of the doubt when you bring this up later. If you assume malicious intent, you'll do damage to your friendship if was an honest mistake; but if you assume good faith, you can't do any damage to your friendship that he hasn't already done himself by acting maliciously.
How you approach him is probably something you know best, since you know him better than we can, but starting by assuming good faith is the most important part. If it was an honest mistake, he's more likely to admit it one-on-one than in front of everyone else. (There is a powerful new-GM urge to appear infallible, which ironically makes the new GM more likely to screw up more and worse because they can't admit when they've made a mistake in order to fix it.)
One suggestion is to talk to him on a non-game day, ideally in person, and explain that you felt singled-out for punishment and you don't enjoy the game like that, so you won't be playing. The goal here isn't to make them admit their mistake, but to draw your own boundary where you don't play in games you don't enjoy and won't agree to anything else. In the meantime, this will also give them a chance to admit their mistake, but that's secondary to enforcing your own good boundaries.
Here's a sample script that might help you:
"I felt singled out during the game. What do you think was going on there?"
Let them talk here. Keep quiet, just listening, and let them say any ridiculous thing they want to say here, until they run out of things to say. They will probably defend, deny, and put the blame on you. Just let them keep talking until they're done. Assuming they don't admit their mistake and don't begin a conversation about how to fix it:
"Okay. Regardless of the reasons, I didn't enjoy playing and I think it's best if I just sit out this campaign."
Let them talk. They probably won't agree, but they don't have to agree with you because you don't need their permission to do something else on game days. Listen quietly until they run out of things to say again.
"I'm sorry you feel that way, but I'm going to do [this other activity you enjoy] on those days, so I won't be playing in this campaign."
(An "activity you enjoy" doesn't have to be big and complicated and obviously exclude playing in their game. It can be something that you could easily do some other time, like "catch up on some reading", "go to the gym more", "nap", "watch movies", or "play videogames". The point is not that this activity prevents you from playing in their game and can't be done elsewhen, the point is that you are the boss of your leisure time and you choose do this other thing instead. You're not saying you "can't" play because of a scheduling conflict [which they may try to fix!], you're saying you "won't" play because you want to do something you enjoy.)
And then end the conversation. Leave, stop answering the next email, close the chat window, whatever firmly disconnects you from them immediately. They probably won't be happy, but you're not responsible for their feelings and with a script like this you haven't said anything that is disrespectful, mean, or otherwise a cause of their unhappiness. Their unhappiness will be entirely because they're not getting what they want / confusing having an unhappy player with being a bad person / otherwise causing their own unhappiness in a way you can't fix for them.
What happens after you walk away is up to them. If they keep pestering you? Just say "Thanks for the invitation! But remember, I'm busy those days." If they change the game day, "Thanks for the invitation! But I'm not available to play in this campaign then either." Always a polite, but firm no, so long as they are insisting that you are the the who needs to do something different.
If they come to you and say they're willing to talk, and do actually admit the possibility that you were honestly not having fun and want to talk about how to fix that, then great! Have that conversation. If it goes south, "Okay, I still think I won't enjoy this game and I should just sit it out," then end the conversation before it becomes an argument. If the conversation goes well though, then I have no advice: hopefully, you won't need any!