Spider-Man is one of the most famous examples. For a long time, it was generally lighthearted and exciting superhero adventures and humor which balanced the more depressing side of Peter Parker's life, troubles, and angst. In short, the superhero stuff was escapism both in the comic and out of it. (Nice, huh?) And then the father of Peter's girlfriend Gwen Stacy and regular supporting character, police captain George Stacy, got killed. Which was followed by Peter's best friend Harry Osborn becoming addicted to drugs. Which was followed by Harry's father Norman becoming the Green Goblin again, kidnapping Gwen, and knocking her off a bridge to her death. The stories only got darker from there....
The comics tend to bounce up and down in this and it's pretty easy to see when the comic is gonna hit the Darker and Edgier mark: watch and see how much Peter has. If he has plenty of stuff and is quite happy, then chances are he's heading for this.
Bone does this intentionally. Over its 14-year run, it went from a cute, kid-friendly comic about sudden snowfalls, greedy relatives and stupid, stupid rat creatures to an epic fantasy saga about a rather horrific Sealed Evil in a Can with graphic violence and death, the threat of genocide, a Religion of Evil, and the aforementioned rat creatures going from harmless comic relief to a deadly threat (except for Those Two Bad Guys among them, who remain comedic.) However, it still managed to kick in humor every now and then, with at least one funny moment every issue. Jeff Smith apparently did this so that audiences wouldn't be "committed to an epic tale right from the start."
Scud The Disposable Assassin's first story arcs included a cult that worshipped "manliness and unnecessary explosions", a cyborg-giraffe crime lord, and a werewolf astronaut. The last few issues pretty much kicked humor to the curb, placing Scud literally in the middle of Armageddon, fighting against both Heaven and Hell. The 2008 4-issue re-launch Time Skips ahead 10 years and manages to make things even darker, but then pulls out to an upbeat ending involving The Power of Love. The author has noted that, if the series had finished as planned, it would have had a Downer Ending where Scud commits suicide and destroys the world, but between the original and relaunch, he moved away from his "angry young man" persona and rethought.
This may have been planned from the beginning of the serial, but the earlier stand alone comics that predated it had no ambition beyond dark humor.
While the initial issues of Archie's Teenage Mutant Ninja Turtles Adventures remained somewhat close to its cartoon source in tone, the series eventually got progressively more serious, with multiple deaths, more introspective stories, and even a scene showing Adolf Hitler's suicide.
Empowered started as a superhero parody with a lot of Fanservice. The first three volumes are mostly comedy, with occasional hints at more dramatic plot developments and backstories. Volume four goes all out, opening with Ninjette apparently dealing with PTSD. Five sees Emp's Crowning Moment of Awesome from the previous book being not only papered over by her Jerk Ass teammates but outright turned against her and the death of one (maybe two) main characters, plus a horde of C-listers. Volume Six is 60-80% dead serious. Volume 7 isn't much better
This happened to Supergirl: Cosmic Adventures in the 8th Grade, of all things. The first four issues are mostly light-hearted, but the last two reveal that Mister Myxyzptlk has been behind everything, and may even have gone back in time and destroyed Krypton in the first place just to make sure he got everyone where he wanted them.
Marvel's New X-Men: Vol. 2 starts out as a low-angst (especially by mutant standards) romp of high school cliques and teen age personal interactions until M-Day, when most of the mutants lost their powers. The series then does a nose dive as the mutant-hating Purifiers start picking off regular cast members one by one and the students fight for survival, including scenes where kids not even old enough to drive are wondering which of them is going to die next, when they aren't literally being dragged to hell.
The Italian demential/slapstick comic book series Rat-Man by Leonardo Ortolani: it started as a Affectionate Parody of Marvel and DC superheroes, but after the first 10 issues, it started to develop darker and edgier stories.
The first two Tintin adventures (Tintin in the Land of the Soviets and Tintin in the Congo) are outright comedies where the action is often surreal and played for laughs (for instance Tintin killing a rhino by drilling into its hide and dropping in a stick of dynamite.) The third adventure (Tintin in America) was transitional with a lot of off-the-wall comedy still mixing with the plot before the series finally found its familiar mood of exciting and suspenseful action with character-driven comic relief with Cigars of the Pharaoh.
Inverted in British comicTammy's serial "Our Janie", which started out as a gritty kitchen sink drama with the titular Janie, a 15-year-old girl, coping with the responsibility of holding her family together after the death of her mother, and dealing with threats to take the children into care or problems finding the money to pay the rent, but soon settled into much more lighthearted episodic storylines about getting mistaken for a film star or rescuing kittens from a condemned building.
Daredevil had been a lighthearted adventurer in his first years. But at the very latest when Frank Miller took over, he was transformed into a depressed, lonely avenger, who had to witness his fiancée getting murdered by Bullseye and who had some terrifying foes like the Hand. It reached its highpoint in Shadowland, where he had a (allthough unwillingly) Face-Heel Turn and became the villain. After this, Mark Waid took over, and after many long years of darkness, Murdock finally got to be lighthearted again.
Marville went from a comic that parodied media and Marvel itself, usually in mean spirited or nonsensical manners, to a philosophical comic about life, the universe, and everything in its third issue. Linkara even compares it to the trope namer:
"Look, if I wanted to read pseudo-philosophical garbage pretending to be a comic book, I'd read something by Dave Sim!"
Matt Fraction's Hawkeye managed to do this in one panel. First issue was sorta-slice-of-life, before delving into Hawkeye and his interactions with his neighbours, him trying to mentor Kate Bishop, and deal with some local criminals trying to operate in the area, with him comically repeatedly running into trouble and having to deal with it via quick wits and his impressive skills. After an issue of Clint dealing with the women in his life, including a messy breakup with his not-quite-girlfriend Spider-Woman, he talks to Grills before heading downstairs then Grills gets shot and killed by 'the Clown', with Matt Fraction confirming the series is now going to get darker.
Superman & Batman: Generations does this deliberately, mimicking the comics of the era in terms of content. The first half of Issue 2 has Supes and Bats deal with Mister Mxyzptlk and Bat-Mite, while the second has each of them losing their respective sons; Dick Grayson is killed by the Joker, and Joel Kent dies in Vietnam though in reality Lex Luthor saved his life, but this only sets up even darker turns of events.
The first couple storylines of Pocket God were more comedic and had the pygmies die often. Later storylines started to get more serious and the pygmies started to die less often. The story arc, "The Pygmies Strike Back", gets stone cold serious when Nooby is killed off for real.
Iznogoud: When the series were taken over by Tabary after Goscinny's death; while the stories remained mostly comical, they started having more coherent adventures with Iznogoud occasionally switching from Villain Protagonist to Anti-Hero.