The story begins with the people having sex with the daughters of Moab.
The people began to commit whoredom with the daughters of Moab. Numbers 25:1
After sex, they ate dinner with them and worshiped their gods.
They called the people unto the sacrifices of their gods: and the people did eat, and bowed down to their gods. 25:2
This angered God so much that he told Moses to kill all the leaders and hang their dead bodies up on trees so that he wouldn't be so angry anymore.
The anger of the LORD was kindled against Israel. And the LORD said unto Moses, Take all the heads of the people, and hang them up before the LORD against the sun, that the fierce anger of the LORD may be turned away from Israel. 25:3-4
Now this probably wasn't as bad as the King James Version makes it sound. "Take all the heads of the people, and hang them up before the Lord against the sun" sounds like God told Moses to cut off peoples' heads and hang the heads on trees. That would be kind of nasty.
But no. God just commanded Moses to kill the leaders ("the heads of the people") and hang their dead bodies on trees out in the sunshine so "that the fierce anger of the LORD may be turned away from Israel." That's not nearly so bad, now is it?
I can't tell, though, whether Moses did what God asked. Here's the next verse:
Moses said unto the judges of Israel, Slay ye every one his men that were joined unto Baalpeor. 25:6
Moses told the leaders (judges) to kill everyone who was "joined unto Baalpeor." I don't know if being joined to Baalpeor was having sex with the daughters of Moab or not. But clearly Moses wasn't following orders here. God told him to kill the leaders and hang their dead bodies on trees; Moses told the leaders to kill the people who were joined to Baalpeor. Different thing entirely, I'd say.
Anyway, it seems like maybe neither God's nor Moses's plan was executed, because of what happened next:
Behold, one of the children of Israel came and brought unto his brethren a Midianitish woman in the sight of Moses, and in the sight of all the congregation of the children of Israel, who were weeping before the door of the tabernacle of the congregation. 25:6
And then the real hero of the stoyr shows up. Phinehas . He saw the happy couple, and stuck a spear through their bellies (while they were having sex?).
When Phinehas ... saw it, he rose up from among the congregation, and took a javelin in his hand; And he went after the man of Israel into the tent, and thrust both of them through, the man of Israel, and the woman through her belly. 25:7-8a
This double murder made God so happy that he stopped killing everyone. You see, while Moses was trying to get the leaders to kill people who had sex with Moabite women and God was trying to get Moses to kill the leaders and hang their bodies on trees, God was also busy killing people with a plague.
So the plague was stayed from the children of Israel. And those that died in the plague were twenty and four thousand. 25:8b-9
Now God had planned to kill everyone, but he stopped with just 24,000 because of Phinehas' holy double murder.
The LORD spake unto Moses, saying, Phinehas ... hath turned my wrath away from the children of Israel, while he was zealous for my sake among them, that I consumed not the children of Israel in my jealousy. 25:10-11
[Paul said that only 23,000 died in the plague (1 Corinthians 10.8), but how would he know?]
So you see my problem here, don't you? How many killings do we have here?
God told Moses to kill the leaders and hang their bodies on trees, but we don't know whether Moses followed God's command.
Moses told the leaders to kill whoever had sex with the Moabite women, but we don't know if his order was carried out either.
Phinehas killed the two people having sex, but we don't know whether God told him to or not. (Even though God was clearly pleased by the killing. So much, in fact that he quit killing after only 24,000 had died, when he'd planned to kill several million.)
And how many died in the plague? Was it 24,000 as Numbers 25:9 says or 23,000 as it says in 1 Corinthians 10.8?
So how do we keep score here? At least 24,000 people died (23,000 if we believe Paul), but in how many separate killing events? And should God get credit for Phinehas's double murder?
I've decided to count Phinehas's double murder and God's plague in God's killings. God clearly deserves credit for the plague, of course, but the Phinehas's affair is less clear.
However both Moses and God ordered people to be killed either for having sex with the Midianites or for allowing them to do so (Numbers 25:3-5), and God was so pleased with the Phinehas's killing that he stopped his own mass murder. So I think God deserves credit for either inspiring or directly ordering Phinehas's murder of the interfaith couple.
So I'm going to ignore Paul and go with 24,002 for this killing.