BEVERLY HILLS, Calif. – "Riverdale" has a very special visitor this year.

CW's Archie Comics-inspired series lost one of its most beloved cast members in March when Luke Perry, who played patriarch Fred Andrews, died after a stroke at 52.

Last season's production schedule meant "Riverdale" was unable to fully address Perry's death (and Fred's departure from the series), until this week's fourth-season opener (Wednesday, 8 EDT/PDT). But Archie (KJ Apa), Betty (Lili Reinhart), Veronica (Camila Mendes) and Jughead (Cole Sprouse) will have a little help saying goodbye to both Fred and Luke.

Shannen Doherty, Perry's friend and "Beverly Hills, 90210" co-star, joins the cast in Wednesday's Fred-centric episode, "In Memoriam." At the Television Critics Association tour in August to promote Fox's "90210" meta-revival "BH90210," Doherty opened up about the emotional and "cathartic" experience.

CW wouldn't reveal what role Doherty plays or how Fred exits the series until after the episode airs, but playing the mysterious character left the actress very emotional.

"It was extremely hard in the sense of the emotions, but I feel really proud and honored and extremely humbled that they asked me and I got to be a part of it," she said.

Doherty reached out to loved ones in Perry's life to make sure they were comfortable with her appearing on "Riverdale."

"I spoke to certain family members and they were behind it," she said. "Luke's manager Steve (Himber) was very supportive, and I went into it knowing that I was being supported by everyone that really mattered to Luke. And knowing that it was a show that he had been trying to get me on since Day 1 (laughs), it was like this really beautiful moment."

Perry's final appearance on "Riverdale" aired in April, although an earlier episode was dedicated to the actor. Creator Roberto Aguirre-Sacasa tweeted over the summer that the Season 4 premiere would be a tribute to Perry.

Doherty couldn't reveal who she was playing on the twisty series, but she was moved by the affection for Perry from the cast and Aguirre-Sacasa.

"That cast loves him," she said. "Loves, loves, loves him. (My role) was cathartic in a lot of ways. Very, very hard and emotional."