The David Trilogy and its eponymous character took the Animorphs series down a darker path than it had ever gone before, forcing its heroes to extreme measures in order to attain victory. While the series was never particularly lighthearted, the trilogy's aftermath saw the War Is Hell aspect really kick into overdrive, culminating in the last ten books.
Nihil from Brian Clevinger's Nuklear Age, who single-handedly transforms the story from a goofy, episodic, villain-of-the-chapter superhero parody into a tragic, post-apocalyptic drama. All of which is intended, by the author's own admission, as one huge joke on the reader.
While the newly-revealed backstory for the Ring made it obvious that The Lord of the Rings was going to have a darker tone than The Hobbit, this doesn't really hit home for either the reader or the characters until the introduction of the Nazgul, and especially of their true nature. Especially noteworthy in that their appearance was completely unplanned: at first, Tolkien wrote about a man in a gray cloak on a white horse (namely, Gandalf finally catching up)...then changed both to black, and took the story into whole new not-Hobbit directions.
Within The Hobbit, Smaug. The book is fairly lighthearted at times outright silly, and usual moments of danger the company has typically hand Gandalf to rescue them from. But they meet Smaug, there's nothing they can do against him and proceeds to burn down a nearby settlement. Even though his killed during his rampage, his actions prompt a darker shift in the book dealing the aftermath the settlement's destruction.
Harry Potter began getting Darker and Edgier from day one, but things start going to hell once Voldemort finally shows up at the end of Goblet. The introduction of Dolores Umbridge in the following book didn't help - while not the most evil villain in the series, she's easily the most rage-inspiring among fans. As if that weren't enough, the same book also properly introduces Bellatrix Lestrangenote Bellatrix Lestrange had earlier appeared in the Pensieve in The Goblet of Fire after Harry accidentally stumbled upon the Pensieve, although it took place in the past and thus doesn't count, an Ax-CrazyHero Killer who quickly establishes herself as Voldemort's right-hand Death Eater.
In Star Wars Expanded Universe, Yuuzhan Vong indirectly killed off Chewbacca, and Anakin Solo died fighting them. They completely destroyed the New Republic. The Star Wars Expanded Universe took a dark turn the minute they showed up and it has not been able to regain a lot of lightheartedness since.
Atlas, a major villain of The Titan's Curse, is the first Titan that the heroes fight and replaces the comedic one-shot villains that the heroes defeated during their journey with invincible skeleton warriors that constantly chase down Percy and his friends. While he is also defeated in the same book he is introduced in, his appearance turns the mood of the series as a whole to show that the Titans just aren't going to sit there waiting for their leader, Kronos, from reassembling himself (that book is also a major Cerebus Syndrome for the series, what with the deaths of two heroes, one of whom is just a 12-year-old girl; beforehand the series is mostly a comedic adventure with lots of actions), not to mention that he also performs the series' first on-screen human murder: his daughter, Zoë.
That's not to mention when Kronos himself makes his appearance in The Battle of the Labyrinth. He manages to give a No Sell to the heroes by slowing down time, though the bit where Rachel smacks his eye with a hairbrush is kind of a Mood Whiplash. And since he's incorporeal, he needs a vessel to reside in, choosing Luke in the process and casting doubt whether the latter could be redeemed anymore (he does, thankfully.)
There's the revelation that Gaea, the frickin' Mother Earth is the Big Bad of the new series. There's absolutely no comedic aspect of her, unlike the hairbrush incident in the previous series, she's responsible for almost all of the bad things that the main heroes experienced (poor Leo and Hazel), and all this before she's even fully woken up. And not like other characters, she's a primordial being, which means that the heroes aren't facing a villain with earthly powers, they're facing the Earth itself.
Thrown out of the window with the introduction of Tartarus in The House of Hades, which is arguably the darkest book in the whole series. While Gaea's still asleep, Tartarus is fully awoken, and he's just as every bit of a primordial being as she is. The heroes make it clear that they don't stand a chance against him and it takes at least two Heroic Sacrifice just to ward him off so the heroes could escape. And what aspect of the world does he represent? Hell, not The Underworld that Hades reigns in, Hell.
While the earlier villains of Septimus Heap were usually too stupid to be real threats most of the time, Tertius Fume since Queste is the first antagonist that became a threat to the Castle itself, signaling the more serious events of the later books.
While opening with a death, Neil Gaiman's Anansi Boys doesn't get truly dark 'til the introduction of Tiger and Graham Coates' subsequent possession.
Though Neal Shusterman's YA trilogy Everlost was never exactly light, it was only darkly fascinating to begin with. Then Mary Hightower shows her true colors and the series gets dead serious.
Professor Moriarty in the Sherlock Holmes canon. Up to the end of The Memoirs of Sherlock Holmes, most of the criminals Holmes has hunted down have been small fry. Suddenly, you have a genius crime lord who is revealed to have been the Big Bad throughout the Great Detective's career, and he's hellbent on destroying said detective. Not to mention... he seems to succeed in that goal — and even when you know that he doesn't, Holmes holds the Professor up as a standard for the criminals who follow.
It's hard to say exactly when the Alex Rider series became Darker and Edgier. Compare the relative innocence of the first book to the very bleak and cynical feel of Scorpia Rising and be amazed. Most likely Cerebus Syndrome was ushered in by Alexei Sarov, the main antagonist of the third book, who was not only a more competent villain than the previous two, but also one whose psychoses and psychology were more serious than the one-dimensional antagonists Alex Rider had faced before. SCORPIA later ushered in an even darker tone filled with death and trauma and even the occasional Downer Ending (Though the bleakness of the ending was lessened due to the sequel). And when Razim becomes involved, the series ditches comedy entirely.
The man with a beard but no hair and the woman with hair but no beard from A Series of Unfortunate Events. Count Olaf is as despicable as they come, but even he gets nervous around his menacing, nameless associates, who arrive just as the series' trademark black humor gets even more grim and mysterious.
Brandon Sanderson's Mistborn: The Original Trilogy starts relatively light, the first book being a heist-novel of sorts, but progressively gets more complex and darker in its deconstruction of fantasy tropes. The Knight of Cerebus in residence is Ruin; when he is freed, things begin to go spectacularly pear-shaped.
Bridge to Terabithia: Leslie Burke is a complete inversion, as she is a protagonist, very friendly and makes the story very light. But when she dies, the story takes a darker and more serious turn, as the protagonist Jess must learn to accept what happened and trust in what Leslie taught him.
Pride and Prejudice is sarcastic and lighthearted until the introduction of Mr. Wickham, who first reveals that Mr. Darcy isn't just snooty, he's the sort of man who would subvert his late father's wishes and deprive a childhood friend of a livelihood. And then it turns out that this is Malicious Slander on Wickham's part (Serious Business back then) and that Wickham nearly seduced Darcy's little sister for her money. Finally he causes a disaster for the Bennets when he runs away with Lydia, which nearly destroys the other girls' prospects of ever finding husbands before their father dies and the estate passes to Mr. Collins. Most of the other difficult characters are pompous at worst, but Wickham is plain nasty.
In The Book of the Dun Cow, the book becomes much darker whenever Cockatrice and his Basilisk Mooks show up. Cockatrice himself is a serious and threatening villain with no comedic qualities at all, and the Basilisks establish themselves by slaughtering almost everyone in the land next to Chauntecleer's on Cockatrice's orders.
The first section of The Secrets Of Drearcliff Grange School is a light-hearted and cheerful homage to old Boarding School stories, with the antagonists being foolish and easily outwitted. Then Antoinette Rowley Rayne appears on the scene, and things become much darker.