Okay, that’s sort of a different situation. The person who wrote that article in the encyclopedia is pointing out the principle of double effect.
Thomas Aquinas is credited with introducing the principle of double effect in his discussion of the permissibility of self-defense in the Summa Theologica (II-II, Qu. 64, Art.7). Killing one’s assailant is justified, he argues, provided one does not intend to kill him. Aquinas observes that “Nothing hinders one act from having two effects, only one of which is intended, while the other is beside the intention. … Accordingly, the act of self-defense may have two effects: one, the saving of one’s life; the other, the slaying of the aggressor.” As Aquinas’s discussion continues, a justification is provided that rests on characterizing the defensive action as a means to a goal that is justified: “Therefore, this act, since one’s intention is to save one’s own life, is not unlawful, seeing that it is natural to everything to keep itself in being as far as possible.” However, Aquinas observes, the permissibility of self-defense is not unconditional: “And yet, though proceeding from a good intention, an act may be rendered unlawful if it be out of proportion to the end. Wherefore, if a man in self-defense uses more than necessary violence, it will be unlawful, whereas, if he repel force with moderation, his defense will be lawful.”
When an action has at least two outcomes, one good and other evil, and that evil outcome is not by itself an intrinsic evil, and the good is proportionate to the evil, then it may be permissible to carry out that act as long as it is the good outcome you seek, and that you regret the evil outcome.
In his example, he does not just refer to a person who happens to be a heretic, but one who is actively leading Catholics astray into destruction. If this person dies a natural death, then there certainly would be the evil of his own death, but there would also be a good involved related to the number of souls that would not be led to destruction had he lived longer. If you simply hope for the death itself, then it would be sinful. Furthermore, you cannot simply violate a commandment either. So it’s not like you can kill this person.
Still, I think that article is a bit dubious because I don’t personally think the example is valid. There really are not two possible outcomes here. The heretic could also be converted back to orthodoxy. That’s what you should pray for. His example only works with the unwritten assumption that this heretic cannot possibly revert to orthodoxy.