Here's a non-Aristotelian but nonetheless virtue-theoretic answer:
When you "do the right thing by doing the wrong thing" in this way, the respect in which what you do is wrong is this: you give evidence that you should not be trusted (as an agent, to do the right thing in similar cases; as an advisor, to give good advice on such matters; as a testifier, to give warrant-conferring testimony concerning the value-theoretic basis of your decision).
What you do is right, but the way in which you do it manifests untrustworthiness (and thus makes trust in you pro tanto unreasonable).
But in another respect, your action manifests trustworthiness, since it manifests a determination to do what's right even when doing what's right requires performing a kind of action that in other contexts would be horribly wrong.
If a virtue marks a respect in which we can rely on someone in the way charactistic of trust, since there are two dimensions of trust in play here there are also two virtues. (1) Should I trust you to reach the right decision on the (type of) matter at hand (and to give good advice about it, to know what values are in play)? (2) Should I trust you to trust your own judgment even when doing so gives evidence of untrustworthiness?
This captures both the the third-personal datum that we make both positive and negative evaluations of the agent, but without introducing quasi-aethetic judgments about the well-scrubbedness of the agent's soul. And it captures the first-personal phenomenology of such actions, whose difficulty derives from the thought that my self-trust requires giving evidence that I should not be trusted.
Here's what bothers me about this discussion (and discussions about evaluating moral actions generally): What's an action?
We pretend that we understand what it means to talk about action1 or action2, but, like a word, an "action" seems unintelligible without context and just as with words, that context depends upon the "actions" themselves and quickly becomes indeterminate. Another complication--and unlike words: it's not even clear when one action ends and another begins: was it one act with a dirty middle or a bad act followed by a good one?
We all know the common and--one would like to believe--naive "god works in mysterious ways" response to the problem of evil: we cannot judge God's actions because we cannot comprehend their place in his plan. Drop the deity, forget the master plan, the problem remains: the rightness or wrongness of an action is beyond our power to comprehend (and that's true even assuming--as I would not--that the massive problem of knowing "good and evil" has been solved).
FL: My aim wasn't to say why the action is "wrong." Of course it isn't really wrong: by ""wrong"" I just mean "dirty" in the sense in which hands are dirty in these cases. My aim was to explicate the sense in which the action is both right and nonetheless importantly "wrong"/ dirty/ filthy.
I'm assuming that the dirtiness of the deed manifests itself as evidence of untrustworthiness. Manifesting that you're willing to kill or lie or cheat in the service of what you believe right concerning matter M gives, I think, immediate evidence that you're not to be trusted on M.
Note well: I don't say conclusive evidence, merely some evidence -- such that any default presumption of trustworthiness is defeated and reasonable trust will require positive evidence of trustworthiness. Of course, in these cases we assume that such positive evidence is available and thus that the agent is trustworthy after all.
Does that clear up at least that one confusion? (My fault: I have a big view here -- though the present application of it is new as of this morning -- and I omitted to say that I meant evidence that would undermine any default presumption of trustworthiness, not conclusive evidence of untrustworthiness.)
Ogged: great to have you back, if only in a comment. Before going online just now I was reading a really interesting, beautifully clear forthcoming paper by Kieran Setiya called 'Explaining Action.' Not, unfortunately, 'Explaining "Action"' or 'Explaining Actionhood' -- so your question doesn't quite get an answer. Still, it's an excellent paper (so far...), and you might want to have a look.
I just wanted to say, Fontana, that I have noted your arrival at Unfogged with approval and interest. I am not always a great one for leaving comments. But, in my inscrutable way, I approve and internally reward the good acts of others in my own soul. Thank you for your thoughtful commentary. Damn, you've been posting a lot of fun stuff.
That's a good objection, FL. I reply by appeal to the intuition -- which I sort of have -- that to the extent that it's clear that the agent is doing the right thing because we can see clearly what 'rule' the agent is following and that the rule is a good one (however that works, and don't put any emphasis on 'rule' here), we'll be to that to that extent disinclined to think that the agent's hands are dirty. Dirtiness of hands, I think, derives from the disorienting unclarity of how the agent could be justified in the present instance. Yet we do think he's justified -- that's what presents the puzzle. "How could doing such a horrible thing be right?" we ask, and we're genuinely puzzled. (Note, however, that I'm not trying to make it merely an epistemic issue. I'm appealing to a metaphysical unclarity.)
I'm trying to explain the puzzlement by diagnosing what's at stake for us onlookers. What's at stake is that we don't know whether to trust this guy. There's a respect in which his action gives evidence that we shouldn't trust him, yet we do believe he did the right thing. But if it becomes too clear why what he did was right, then (as in the case you're imagining) we don't think the action gives evidence of untrustworthiness. And my claim is that in that case, we don't really have a case of dirty hands.
So the claim is that our inclinations to make the two judgments 'That's dirty!' and 'That gives pro tanto evidence of untrustworthiness!' march in step in this context.
(Do I have a potential publication yet?)