Depends on your sense of humor.
Rosalind Shays (Diana Muldaur) on LA Law exited the series by famously walking into an open elevator shaft. Goodbye Rosalind Shays - YouTube
The surprise scene where Roz and Leland are seen in bed together was ranked as the 38th greatest moment in television in an issue of EGG magazine. Equally spectacular was Roz’s fatal exit from the show, falling down an elevator shaft. Muldaur joked: “I was as shocked as everybody else. I thought maybe I had asked for too much money!” Diana Muldaur - Wikipedia
The things that Penelope can do with her computer are certainly comedic.
I’m getting truly desperate now.
All I have is another Simpsons character: Snowflake the cat…
TCMF-2L
Why do I always come up with a better example just after I have posted?
How about Kristine Z. Kochanski (Lister’s love interest) from British Sci-Fi sitcom Red Dwarf?
This example slightly complicated since, in Red Dwarf fashion, Kochanski has died, but has also returned as a hallucination, from an alternative universe, as a hologram and not to mention been portrayed by a couple of different actresses over the years.
TCMF-2L
Snowball II (and III and implied IV).
Not sure if you call “Nichols” a sitcom…a humorous western is probably more accurate. But in the last episode the main character, played by James Garner, is killed and later on his twin brother, also played by Garner, comes to town. He leaves at the end but says he may return someday. Apparently the producers were hoping it would get picked up for a second season and having Garner as a twin brother left the door open. Garner in later years said he proposed killing the character off because he didn’t want the show revived.
There is also George and Marion Kirby, along with their dog Neil, killed in the first episode of "Topper" but staying on as "that sporting spirit" and "the ghostess with the mostest".
Nitpicks: Their name was “Kerby” and Neil wasn’t their dog initially. They met Neil just prior to the accident. Can you own a ghost-dog?
I had considered this example but ruled it out since my recollection was that the show started with Topper moving into the haunted house. (Hence George and Marion weren’t killed during the run of the show.) But apparently the series did start with them alive (for a small bit) and then jumped to Topper moving in.
Anne Jeffreys, btw, is the only surviving major cast member. Of course it would be one of the ghosts.
There have been similar ghost-comedies. But for ones like My Mother the Car, the deceased died prior to the start of the series.
Didn’t two characters (Hill & Renko) die at the end of the pilot episode of HSB but were later retconned to say that they survived?
They’re shot but aren’t pronounced dead
The original scene had Esterhaus reporting to Furillo: “Two men down. One critical, one DOA.” Renko (with his cowboy boots) was the one killed, but test audiences liked him so much, he was resurrected and that scene was reshot.
This is why Charles Haid had a special credit at the start of each episode. His contract was different from those of the people who originally signed on.
In “The I.T. Crowd”, the big boss, Denholm Reynholm (Christopher Morris) kills himself because he’s being investigated by the police. He’s replaced by his son Douglas, who shows up at his dad’s funeral.
It’s one of my favorite British sitcoms.
Last Man on Earth killed off the *other *Phil portrayed by Boris Kodjoe. He was killed off in a botched appendectomy.
Every version of The Doctor (Doctor Who) was killed off.
He regenerates as a new actor. 13 so far
Sitcom?
Well, they’ve not all been killed off yet.
Not a sitcom but, come to think about it Bob Newhart’s character’s ghost appeared several time in the series The Librarians.
John Goodman’s character died in the final episode of the first run of “Roseanne”, but will apparently be back in the new reboot as if nothing had happened.
Chuck Cunningham has been buried under the concrete floor of the Cunninghams’ basement since the first season of “Happy Days”…
-MMM-
I suppose the weekly (often big-name) guest stars on the old Police Squad don’t count as ‘major characters’?