If we have to use math, I'd say: the headaches are temporal - the effect of all the good you've done today is effectively gone tomorrow one way or another. But killing a person means, to quote "Unforgiven", that "you take away everything he's got and everything he's ever gonna have". So the calculation needs at least a temporal discount factor.
I also believe that the examples are too contrived to be actually useful. Comparing a room with one person to another with five million is like comparing the fine for a person traveling at twice the speed limit with that of someone traveling at 10% the speed of light - the results of such an analysis are entertaining to think about, but not actually useful.