That action was a little bit "cowboy" for us, sure, but who would you rather perish? Much of our military and (possibly) government thanks to the rising threat of Iran, or (as you mentioned), Iran's #3 man, along with a large number of people who already imposed plans to attack us?
I absolutely understand where you are coming from. Those people aside from the general DID NOT deserve to die, but if it was too late, the deaths caused by that general would've most certainly exceeded the deaths of those around him.
Also -- (Just speculations but it makes the most sense) They had their eye on the general for a while, so by launching that airstrike at that specific time would've most certainly been the right action to take since waiting any longer (as I mentioned) would've put the general in an even worse location where air striking could've potentially killed way more people than just the size of their secretary of defense.
Again, I completely feel you on the sad and terrible deaths of those innocent Iranians, I couldn't imagine my own family or friends dying for another country's government one day, but the risk was too high to let the general run around loose, especially if he were to secure himself after knowing our plot or even just because.