Heinz Doofenshmirtz

Dr. Heinz Doofenshmirtz is the main anti-hero of the Disney Channel animated series Phineas and Ferb and the arch-nemesis of Perry the Platypus.

Heroic Moments
In spite of Doofenshmirtz's reputation as a villain, he will tend to play as the hero whenever it either benefits him the most or if he doesn't have a choice. Such examples are included:
 * He finds a stray cat and decides to adopt him, naming him Mr. Fluffypants after his uncle Fluffypants Doofenshmirtz (who, oddly, doesn't wear pants). Despite the cat making a mess with several of Doof's -inators, he almost fell the building, only to be saved by Doofenshmirtz. However, Doofenshmirtz falls from the building, but Perry manages to rescue him and the cat. Eventually, Doofenshmirtz learns that the cat belongs to a kid who's been looking for him, and decides to return him (presumably to spare his lab of the cat's antics). ("Spa Day")
 * He bought a Mary McGuffin doll from the Flynn-Fletchers at a yard sale. He then gives it to Vanessa, exclaiming that he spent years scouring the Internet and garage sale trying to find the discontinued doll. At first, Vanessa is a little disappointed, but soon starts to appreciate it, finally seeing how much her father is trying to show his affection for her in spite of his reputation as a villain. ("Finding Mary McGuffin")
 * Doofenshmirtz struggles to search for Vanessa after another of his botched schemes caused her to travel around the world by mistake during their vacation. To do so, Doofenshmirtz convinces Monogram and Perry to help him out, even having equipped Vanessa's earrings with a GPS tracking system that allows them to follow the track. Eventually, they reach to Paris, where Doofenshmirtz finally spots Vanessa on the Eifel Tower and complained that he had to travel hallway around the world to get her. Upon learning this, Vanessa is touched by her father's efforts and goes off with him to continue their vacation. ("Phineas and Ferb Summer Belongs to You!")
 * Phineas, Ferb, and Perry were about to be killed by 2nd Dimension Doofenshmirtz, but Doofenshmirtz arrives to rescue them by ordering his evil counterpart to stop. He also presents out his childhood toy train and gives it to 2nd Doof, who is somewhat touched by this and decides to take back all of his evil schemes for good. (Phineas and Ferb The Movie: Across the 2nd Dimension)
 * Doofenshmirtz spots a swarm of bees threatening Vanessa and her friends on a camping trip. Thinking wise on this, Doofenshmirtz selflessly douses himself with honey to lure the bees away from the teens. He gets stung before diving into the water, and Perry would later help him out from the water. ("Skiddley Whiffers")
 * Doofenshmirtz feels uncomfortable that Monogram's intern Carl Karl is taking over the Tri-State Area after being hit by Doofenshmirtz's Ultimate-Evil-Inator ray. Deciding to set things right, Doofenshmirtz sets Monogram free and starts building a Re-Good-inator, using the parts from one of O.W.C.A.'s jet. He manages to fire the Re-Good-inator at Carl (with the help from Perry), turning Carl back to his good self. ("Where's Perry? (Part Two)")
 * Doofenshmirtz and Perry get themselves lost in a desert and blame each other for what happened. Eventually, Doofenshmirtz manages to find a bus station and board on a bus to get back to Danville after Perry paid two tickets, but Perry is denied to get on board, since the bus don't allow animals inside. Later on, Doofenshmirtz starts to feel guilty of leaving Perry behind and decides to go back for him. He manages to find Perry's lost jetpack and uses to rescue Perry from the scorching heat before they fly to Danville. ("Road to Danville")
 * Doofenshmirtz hired a platypus hunter named Liam McCracken to trap Perry in the Danville Botanical Gardens. However, Liam betrays Doofenshmirtz by trapping him as well, planning to turn both foes into trophies. As a result, Doofenshmirtz and Perry (who Doof thinks is abnormal Platypus named Steven) are forced to work together to stop Liam, and in the end, when Liam is about to kill Perry, Doofenshmirtz manages to get the groundskeepers to the scene to stop Liam at his tracks, saving Perry from an awful fate. ("Primal Perry")
 * Doofenshmirtz takes credit for accidentally stripping the powers of the Hulk, Spider-Man, Thor, and Iron Man with the usage of his Power Drain-inator. But it wasn't until the villains, Red Skull, Whiplash, Venom, and MODOK. arrived and betrayed Doofenshmirtz by imprisoning him in a cage and taking his Power Drain-inator in an attempt to destroy the Tri-State Area and rule the world. After being freed by Perry, Doofenshmirtz aids the heroes (who would later get their powers back) by shooting his Waffle-inator at the villains as revenge for their betrayal against him. ("Phineas and Ferb: Mission Marvel")
 * In spite of his megalomania, Doofenshmirtz is shown to hate world domination in general, believing to be crazy. ("Minor Monogram") He is even horrified when Rodney announces his intention of taking over the Earth by sending it to a new ice age with his new -inizor. Not wanting to let this happen, Doofenshmirtz angrily engages into a fight with Rodney and defeats him with a mop. He then destroys the -inizor by tilting it off the roof (with the help from Perry, Carl, Monogram, and Monty). After Rodney is arrested and taken into O.W.C.A. custody, Major Monogram thanks Doofenshmirtz for saving the Earth, though Doofenshmirtz states that he's still evil, to which Monogram agrees with. ("Phineas and Ferb: Save Summer")
 * Doofenshmirtz learns that his father's lawn gnome is still in Druselstein when it was repossessed during his childhood. Seeing this as an opportunity to heal old wounds, Doofenshmirtz enlists Perry to help him find the gnome. Though they manage to find it, the gnome accidentally broke into pieces after Doofenshmirtz slip into his father's home. Doofenshmirtz's father compliment him of bringing a rubble of piece as a nice gift, which leaves Doofenshmritz very disappointed. However, Doofenshmirtz is soon by cheered up by Perry before they leave, and later on, Doofenshmirtz's father recognizes the gnome's code number on the floor, and fixes it up before putting it outside his house, finally appreciating of what Heinz is doing for him. ("Father's Day")
 * After an accidental scheme that causes almost everyone around Danville to turn into zombie versions of himself, Doofenshmirtz decides to put an end to it. To that end, he aids Phineas, Ferb, and their friends into fixing up a pulley system to the local water tower, where the kids will spray all of the water around the city to turn everyone back to normal. To save them, he aids Candace and Vanessa into warding off the rest of the zombies, but after Vanessa and Candace are turned into zombies, Doofenshmirtz offers himself as bait to the zombies, allowing Phineas, Ferb, and Isabella to finish up the job and turn everyone back to normal. ("Night of the Living Pharmacists")
 * Doofenshmirtz is teaching at Danville High School and brings up a lecture on genetics to his class. Using a hair sample from one of Vanessa's friends Johnny, Doofenshmirtz explains about genetic coding inside the hair sample and tampers with it as an example to show how fragile it is. A couple of seconds later, several talking insects started a chain reaction that causes the hair sample to be slapped into Johnny's face, mixing its DNA with his and transforming him into a lizard-primate mutant. Fortunately, Doofenshmirtz manages to concoct a proper antidote (with the help from the class) and uses it to turn Johnny back to normal to avoid any more trouble. ("Doof 101")