In James Patterson's Alex Cross novels, FBI Agent Kyle Craig starts out as one of Alex's partners in solving cases. Then he is revealed to be a master criminal and Serial Killer with a vendetta against Alex that plays out over some of the latter books.
In The Secret River, Thornhill isn't exactly heroic to start with. But he goes from ambiguous to a villain.
An even more "they shoulda seen it coming" example: Raistlin Majere in the original Dragonlance books.
Subverted with Veres in Loyal Enemies. After he finds out who the Big Bad is (his long-lost love whom he believed dead), he seems to be willing to aid her, especially after she outlines him her causes. He's just pretending to get access to Shelena's cell and free her.
Subverted in Red Seas Under Red Skies, where the first chapter has Jean betraying Locke to a pair of assassins, then it flashes back to the start of the story. When it arrives back at the betrayal scene, we find that Jean was tricking the assassins and Locke just missed the hand signal for "lying."
A certain Imperial general in one of the later Warhammer 40,000: Gaunt's Ghosts is eventually corrupted by Chaos. Surprisingly, he's shown to actually be a decent man when hit by amnesia - even his jailer notes that the general becomes ever more an unlikable bastard as he regains his memory.
In Death of Antagonis, captain Toharan and Inquisitor Lettinger. Oddly enough, Lettinger is confident that it's the rest of Black Dragons who has turned to Chaos.
Dybbuk from Children of the Lamp, though it was sort-of foreshadowed in that his father just happened to be Iblis, the most evil djinn of the most evil djinn tribe, meaning he was half Always Chaotic Evil. It wouldn't be surprising if he eventually had a change of heart, though.
Word of God has it that this trope is the reason for every single villain and Always Chaotic Evil species in the Legendarium. The idea is that all things are intrinsically good at their beginning - they turn to evil as the result of corrupt influences or for wanting too much power.
Aramis, in the D'Artagnan Romances by Alexandre Dumas. In The Three Musketeers he's unequivocally One Of The Good Guys, alongside Athos, Porthos and D'Artagnan — although even then, when short of money, we see him accepting expensive gifts from his mistress(es). In 20 Years After, all motives are less certain, Athos and Aramis find themselves (for different reasons) on the opposite side to Porthos and D'Artagnan, it is far less clear which side is In The Right, and it takes much more intricate politics to have them all on the same side again with their disparate interests in agreement: and, in the end, Aramis becomes the true, shadowy villain of The Vicomte de Bragelonne, as the person who wants King Louis replaced by his secret twin brother Philippe, not in pursuit of justice but in pursuit of his personal ambition to be Pope (and those of the Jesuits, to establish further control over Europe's rulers): and, knowing that he could not suborn Athos or D'Artagnan to this scheme, he tricks Porthos into assisting it instead. And yes, here, Aramis is a true villain even when presented in a good light, and the Musketeers' accord is blown apart: because for all King Louis's inadequacies, he is the rightful king, and in the book D'Artagnan recognises this and sides with Louis, conducting the ill-fated Philippe back to jail (though he later refuses to actually open fire on the fort containing his friends, D'Artagnan holds to their compact to stand together even though Aramis has broken it: as a result of which Aramis escapes at the cost of Porthos's life.) It is Louis who remains on the throne and leads France to greatness. It's also amazing how many films of "The Man in the Iron Mask" reverse the ENTIRE point, and have Louis be unequivocally bad, and the Musketeers all on the same side and succeeding in pulling off the replacement... Though that may have been Dumas's point.
The main Love Interest from Ursula Vernon's Black Dogs turns out to have been modified by the Big Bad before the novel even started to appear much nicer and gentler and less evil than he would be normally. Towards the end of the novel, the Big Bad reverses these restraints and the Love Interest becomes a major villain.
Peter Pettigrew, who everyone thought was James and Lily Potters' friend — until he betrayed them to Lord Voldemort and caused their deaths, which everyone initially blamed on Sirius. And Snape's involvement with that whole issue; he had one when he and Lily were in school, where they had a row and parted ways, leading him to the Death Eaters/Dark Side, although he really always loved Lily.
It's hard to imagine that Percy was unaware Umbridge was ordering muggleborns' souls to be removed. A sufficiently dictatorial system CAN compartmentalise to this degree, through threat of violence and/or careful selection of personnel, and the Ministry under Voldemort qualifies. When he turns up for the final battle, Percy says his decision to turn face has been building for some time, so maybe he's been hearing hints and putting two and two together.
In The Demonata series, Nadia Moore was one of the disciples who later joined Lord Loss, masquerading as Juni Swan.
In The Fires of Affliction, Prince Jarden and Alorica Durnham, the prince and princess of two rival kingdoms, are both kidnapped by a Mystery Cult. When they try to make a break for it, Jarden holds the cultists off so that Alorica can escape and warn the royal families. In gratitude, Alorica joins a later mission to rescue Jarden only to find that the cult has already brainwashed him in the meantime, and that he's now one of them, body and soul.
Nimue in The Warlord Chronicles is an interesting example — her motives and methods don't change, but all of the other heroic characters learn to compromise, and she never does.
In The Hunchback of Notre Dame, Archdeacon Claude Frollo is a compassionate man in the beginning, but after seeing Esmerelda, he goes mad with lust and slowly becomes evil, desiring to either have her for his own or kill her if she won't become his.
Gregory Kawakita at the very end of Relic, whose actions in turn lead Dr. Frock to undergo one in its sequel Reliquary.
This is what Katniss believes has happened when Joanna "attacks" her in the second book of The Hunger Games. She then comes to the conclusion that their other ally Finnick must be in on it as well. Katniss was wrong and both Joanna and Finnick were actually trying to keep her and Peeta alive.
In Seanan McGuire's Velveteen vs. the Junior Super Patriots, playing with this is central to the series. In the Back Story, the carefully hushed up secret beginning of the Super Patriots had one.. The Claw appears to be playing it straight, as do the Marionettes from alternate universe. Whether the appearance is the reality, and the extent to which the reality is driven by their treatment is brought up again and again.
In the Goosebumps book Calling All Creeps, the whole story ends on this note. After seeing how futile opposing the Creeps is, and wanting revenge against his bullying classmates, the boy who was trying to stop the Creeps decides in the end to become a Creep himself, because he would be their leader.
Nightmare Hour: Christopher manages to survive being tickle-tortured by clowns by becoming one of them with the special talent of picking out scared children as future victims.
The Apprentice Rogue: Falita betrays the Order of Black Knights and her kingdom by stealing Leaoa's necklace and running away. The sequel sample confirms that she's become a criminal.
Ward Littell in James Ellroy's American Tabloid. Over the course of the novel, he goes from crusading FBI agent willing to put it all on the line to destroy The Mafia to working as house counsel to the biggest mob bosses in the country. As the book draws to a close, he conceives and orchestrates the JFK assassination and murders his best friend Kemper Boyd to stop him from preventing it.
In the Rivers of London books PC Lesley May is the beautiful best friend (and slightly more competent police officer) to the hero Peter. In book four, Broken Homes, she tasers Peter in the back to allow the Big Bad to escape. The reason is that at the conclusion of book one she had her face irreparably torn off by dark magic and the Big Bad has found a way to heal her, but only if she switches teams.
In the last Age of Fire book, Rayg has one of these, joining with Infamnia/Red Queen in her plans to decimate and enslave dragonkind. RuGaard thinks the change is just him snapping after spending most of his life enslaved underground, but it's actually strongly implied to be a result of his years of exposure to the sun-shard crystals.
Tasha Ozera from Vampire Academy, goes from a political activist urging Moroi to learn self-defense and stop using dhampirs as shields, to a murderess and corrupt political figure.
The main characters in Lammas Night spend most of the novel worried that their Reverse Mole Dieter may have actually pulled one of these. He didn't.
In The Dark Is Rising Hawkin betrays the Light after his master Merriman Lyon risks his life as part of the security system to protect the Book of Gramarye.
The Walking Dead: Rise of the Governor tells the tale of how a guy named Philip Blake eventually became The Governor, slowly showing how this capable but flawed man became one of the most infamous villains of the series. Until, in the end, it turns out that it's actually Philip's reasonable, sweet-natured, weakling older brother Brian who becomes The Governor, taking his brother's name, identity, and personality as his own.
Violete of The Dinosaur Lords becomes a devout follower of Raguel the moment he decries her faction to be wrong and starts converting others.
High King Kallor: If you call it a sudden reversal of strategy, the sting fades.
In The Traitor Son Cycle, Ota Qwan starts as a Reasonable Authority Figure, if a bit hot-blooded, and fights his hardest for Sossag's survival. However, Thorn manipulates him into returning to his past life as Kevin Orley, a man with a massive grudge on the Muriens family, thus pulling him over to his side.