The ends are the only way to justify the means; what the sloppy thinkers who recite "The ends don't justify the means" really seem to mean is that some means are not justifiable. Which is undeniably true, but because they don't really think their position/slogan through, they often end up gathering a bunch of nonsense along with it.
You're right. Slaughtering 20 junior school students and a crossing guard are not acceptable means to get your daughter from school to her dentist appointment on time. It is however acceptable to kill 20 enemy combatants to rescue a dignitary from a besieged embassy.
The phrase "The ends don't justify the means" is not hyperbole to discredit accomplishments, nor is it meant to remove the ends from the equation. It changes the equation to provide the necessity of weighing the ends against the methods rather than measuring the ends independent of the context used to accomplish them.
What is even more interesting is the opposite. The ends not justifying the means is typically used for weighing the actions necessary for a favorable outcome. If looked at from the opposite perspective, do the means justify the ends, it presents a more difficult scenario. If X people die, but only appropriate means were used (and others would have saved X people), should those that chose the appropriate actions be held responsible for the failure to provide a favorable outcome? Or should they be heralded for making the difficult decisions to only use morally acceptable practices?