I couldn't think of a more perfect scenario for a justified homicide and the outcome was as it should be. Good guy unhurt, bad guy toes up.
On the .40 vs. 9mm debate: Both are good so long as you select good ammunition and are capable of putting it, whichever caliber, in the right place. My preference is the .40S&W but I'd take some of the better 9mm loads over a mediocre .40. Also, as the old addage goes: a 9mm in the target is better than a .40 over its shoulder.