The Gemarah in Sanhedrin (106A) says that Billam was killed in the Midyan war, because he had come to collect payment for the 24,000 Jews that were killed through his idea. This seems to indicate that 24,000 was the total amount, because if there was more, I'm sure Billam would have been the first to come and collect his reward for it. However, it's entirely possible more died subsequently and not during this exact plague.
As for those who served Ba'al Pe'or, Rashi says that the passuk means that each judge killed 2 people for a total of 172,000 people who got stoned for serving Ba'al Pe'or.