In Haou Airen, Hakuron seems to view his murder of Reilan this way.
In Naruto, Naruto's classmates plan to kill Sasuke to prevent another war starting from Sasuke going too far and to end Naruto's suffering over his promise. They're very much NOT happy about it, though.
Shinji is forced to kill Kaworu, the only person who truly understood him. Otherwise, humanity will be destroyed. What makes this even more painful is that Shinji spends a minute deciding whether or not to do it, while we see a long shot of EVA-01 holding Kaworu, accompanied only by Beethoven music - ironically, Kaworu's favorite. Needless to say, Shinji suffers yet another Heroic BSOD after that.
Gendo himself does this when faced with the 13th Angel, Bardiel, who had just taken control of the Eva Unit 03 moments before the first test was supposed to start. When Shinji refused to destroy the Angel (and the Eva with it) due to the risk of injuring the Eva's pilot, Gendo takes control of the situation and takes Eva Unit 01 from Shinji's control, using a backup system to do the deed. Shinji isn't happy, and attempts a Roaring Rampage of Revenge... before being stopped by Gendo himself.
Arguably, most of Gendou's actions could also fall under this trope, though whether or not he's being morally ambiguous for the greater good, or just a manipulative bastard is debatable for most of the series.
Considering how powerful Geass Users can be, even children, it would be nearly impossible to achieve victory without killing them. Lelouch's other plan, using his own Geass, suffers from one problem: Geass that do not require eye-contact. Though Lelouch does acquire Jeremiah, who can make that possible, the same event leaves him without the desire to do so.
Additionally, there is the incident where Rolo ganks a fellow intelligence operative for accidentally walking in on a conversation about Geass. Rolo specifically invokes this trope when Viletta criticizes him for doing so.
Trigun: When Zazie the Beast, a particularly cruel member of the Gung-Ho-Guns who happens to look like a pre-teen, was gunned down by Wolfwood before he could kill another person. This enraged Vash, who has an extremely strict code against not killing anyone no matter what.
Wolfwood's anime backstory reveals that most of his life consisted of shooting various dogs, but in the end regretted he could never walk a path as straight as Vash's.
Fullmetal Alchemist has Scar with an almost literal shoot-the-dog moment when he Mercy Kills the chimera that was created when Shou Tucker fused his daughter, Nina, with her dog, Alexander. Ironically, this doubles as a dark Pet the Dog moment, as Scar expresses sympathy for her where up until this point he had been a cold-faced killer.
Olivier: However... you'll find I'm not as merciful as the "Hero of Ishval"!
When Kimbly takes Winry hostage and threatens to kill her unless Ed agrees to work for the army, Ed (reluctantly) takes a third option: He lures Kimbly into an open space while the snipers who are on Ed's side hide in the buildings around it. Unfortunately Kimbly sees through this plan before any of them can shoot.
In the finale of Episode 77 of Sonic X, Tails is forced to fire upon Cosmo, who has transformed into her adult form, and has bonded with the Metarex to form a weakpoint for Tails. Tails, having fallen in love with Cosmo, does with great sadness pull the trigger. The 4kids version of this is far less dramatic/sad, and actually makes Tails look like a bit of a heartless prick.
In YuYu Hakusho, the Urameshi Team is stuck playing a video game come to life with a little boy named Amanuma. This means that everything in the game plays out exactly the same in real life. If Yusuke and the heroes lose, they can just start over until they win; if they win, the villain, Amanuma, dies. Kurama, realizing that this is a trap and that Sensui intends for them to be stuck because they can't kill a kid, beats him anyway. What's more, he tells Amanuma exactly how things will play out to mess with his head, so that he can win faster. Amanuma, being a child, freaks out and loses in an Alas, Poor Villain way. Fortunately, Death Is Cheap and Koenma has a Reset Button handy... which drains his power and prevents from stopping Sensui on his own, which was Sensui's REAL goal in setting the heroes against Amanuma.
Incidentally, this little stunt pissesoffKurama to the point enough so that when they confront the next of Sensui's super-powered henchmen, he simply takes a step forward and decapitates the guy in a blink. And that's just the start...
In Naru Taru, Shiina confronts her close friend Hiroko at her home following a number of gruesome murders committed by Oni, Hiroko's Mon. After failing to talk her out of her insanity, as well as the realisation that her own father is in danger of being killed by Oni too, Shiina tries strangling Hiroko to death in a rage, but finds that she can't bring herself to do it... so her own Mon Hoshimaru has to finish the job for her. She suffers an Heroic BSOD afterwards. In the anime, the dog ends up being shaggy because the epilogue follows almost immediately afterwards.
Rossiu's job in the second half of Tengen Toppa Gurren Lagann, which is to do the "most logical" thing, while the Hero does the Rule of Cool thing. In a short time he orders the execution of Simon to put down the riots (which doesn't work) and gives in to the Anti-Spiral's ultimatum, thereby trying to leave hundreds of thousands to die so he can save a tiny minority... except not, since the Anti-Spirals plan to kill everyone anyway.
The main protagonists of Wei▀ Kreuz are formed into a team of assassins for the express purpose of shooting the dog whenever necessary, a point which his teammates make explicitly when Omi has a crisis of conscience.
In Baccano!!Drugs and Dominoes, Luck Gandor kills Gustavo himself after preventing Eve from shooting him, which given the circumstances is probably this trope in action, although Luck has an attack of Post-Victory Collapse before he can explain his reasons.
Kino's Journey. A young woman whose love was killed by a gunfighter travels the world with a male admirer, preaching nonviolence. Kino mentions that it's strange they've never run into trouble. It turns out the man is a highly-skilled gunfighter who is secretly killing anyone who would threaten her.
In the Legend of Galactic Heroes Gaiden Disgrace, sweet innocent old lady Johanna tells Kircheis he'll have to shoot her to stop her destroying critical evidence against her husband (guilty of causing the deaths of any number of people). Kircheis just can't bring himself to do it; luckily (and tragically) Keyserling, who was in love with Johanna and previously orchestrated the coverup to protect her husband, arrives to do it for him. Kircheis later thinks that Reinhard would have fired had he been in the same situation, and that's why it's important for them to stick together. Perhaps a reversed example as it's the sidekick, Kircheis, who needs the main character, Reinhard, to shoot his dogs for him.
In Elfen Lied, during the finale Kouta is forced to fulfill a childhood promise to Lucy and kill her when she poses a danger to the world. She is also falling apart so it could be a doubled-up example. Though both of her good personas urge him to this while they have control he at first lacks the will to do it. The third persona, said to be the voice of her murderously-programmed DNA, then asserts control, but is ultimately in so much pain, she too urges him to do it, and this time he does.
Occurs towards the end of Mobile Suit Gundam 00. Anew Returner has managed to break the Mind Control of Big Bad Ribbons Almark and is about to surrender to her lover, Lockon, who is urging her to have a Heel-Face Turn so she can join Celestial Being for real. However, Ribbons takes control again as soon as Lockon lowers his guard, forcing teammate Setsuna to kill Anew. Understandably, Lockon takes it badly, but sorta recovers in a surprisingly short time.
A similar example happened in Mobile Suit Gundam Seed Destiny: In episode 32, Shinn manages to calm Stellar down when she destroys everything in her path due to being terrified of her own possible death. Their reunion is short-lived when she spots Kira/Freedom Gundam; Stellar then recalls Neo's words (if she doesn't fight, she will die, and so will her friends and loved ones) and massively freaks out. Shinn tries to calm her down again to no avail.., until Kira intervenes and destroys the Destroy Gundam, killing Stellar in process.
In Episode 5 of the 1968 Cyborg 009 series, Joe does this.
What the Anti-Hero Ogami does in Code:Breaker right in the first chapter, though replace "Shoot" with "Break the Neck of." The aforementioned dog got mortally wounded trying to protect Sakura from a bunch of gang members, and Ogami, before burning and killing all of the bad guys, goes up to the dog and commends it for its efforts to save Sakura. And then promptly snaps its neck to "help the pain."
In Nabari No Ou, Aizawa kills a mission target when Kumohira's moral code makes him hesitate.
Noir: It turns out that this is the entire purpose of the assassin duo named Noir, by becoming a scapegoat of sorts for humanity, killing people so that others don't have to.
In Mahou Sensei Negima!, Mana tends to do this sort of thing, such as being willing to K.O. people who are in danger of triggering the Power Incontinence of The World Tree. Most recently, she was going to shoot Fake!Asuna with non-lethal ammo to determine whether she was real or not. Negi stopped her, though.
Near the end of Digimon Tamers. Janya Wong figures out a way to defeat the D-Reaper. However, this method has the nasty side effect of forcing all Digimon (specifically, the ones that just helped save the world) back into the Digital World, with no guarantee that they could ever return. At a loss for any other options, Janya goes through with it, even going so far as to trick his Digimon-loving son into helping. (Henry's reaction to this varies by translation: he forgives his father in the original Japanese, but the English dub strongly implies the opposite.)
In Bleach, at one point the quincies kill a large number (tens of thousands) of hollows, a kind of monster that Was Once a Man. Because this eliminates the soul of the hollow in question entirely, the Soul Reapers are forced to respond by killing a corresponding number of their own citizens to maintain the balance and prevent the universe from breaking.
In Kirby Right Back At Ya!, we learn that Meta Knight killed Knuckle Joe's father - but only because he had to do it to ensure the safety of the galaxy and because Joe's father was mind-controlled by Nightmare and turned into a Demon Beast / monster. Luckily, his love for his son prevents him from fully surrendering to Nightmare, and before death, he gives MK his locket with Joe's baby picture in it as both a reminder of him and a sign of his love.
Tales of Vesperia: The First Strike is a movie that details events that happened prior to the game. One of those events showed a sad moment where Yuri was forced to kill Lambert and two other guard dogs to free them from a trance put on them by a tentacle monster (which had been scooping up people, eating them, and spilling their blood) and not only protect Hisca, but also ensure the safety of the people of Shizontania.
In Pandora Hearts, Retrace LXXVIII, Well-Intentioned ExtremistHero AntagonistOswald/Glen Baskerville attempts to execute Oz, who he deems is too dangerous to let live, and then use the Will of the Abyss to travel back in time and kill his sister Lacie before she can give birth to the Alice twins and give life to B-rabbit Oz, all to the end of avoiding the Tragedy of Sablier.
Oswald having to kill Lacie in the first place because she was born a Child of Misfortune, which by nature cause interferences with the Abyss.
In Puella Magi Madoka Magica, Homura shoots Madoka's soul gem in the third timeline, rather than allow her to turn into a witch.