Warning: SPOILERS ahead for Once Upon a Time in Hollywood.

Quentin Tarantino’s Once Upon a Time in Hollywood includes a Luke Perry cameo, but what’s the context for the scene? Set in 1969 Los Angeles, the film incorporates the Manson Family as well as several other real-life inspirations, including the television series Lancer.

Once Upon a Time in Hollywood stars Leonardo DiCaprio as actor Rick Dalton, who turns to guest-starring on hit TV shows, primarily as the villain, after his show, Bounty Law, gets cancelled and his movie career fails to take off. One of those shows happens to be Lancer - a real-life series that aired on CBS from 1968 to 1970. It's during a meta sequence on Lancer that DiCaprio shares the screen with Perry, who is best known for starring roles in the iconic ‘90s series Beverly Hills 90210 as well as the modern hit Riverdale. But he trades in his heartthrob persona for a Western actor in Tarantino's film.

Related: Once Upon a Time in Hollywood Cast & Cameo Guide

About halfway through Once Upon a Time in Hollywood, Perry has one scene as real-life Lancer actor Wayne Maunder, appearing in a recreation of the series' pilot episode, "The High Riders". However, the version of the episode that Perry stars in opposite DiCaprio - whose character, Rick Dalton, plays the heavy - is different from the one that aired on television all those years ago. As for Maunder himself, he appeared in 51 episodes as Scott Lancer, the half-brother of Johnny Madrid Lancer (James Stacy, who's portrayed by Timothy Olyphant in this film).

Wayne Maunder in Lancer

Tarantino uses the Lancer sequences to underline Rick’s decline and subsequent growth. The actor first converses with castmate Trudy Fraser (Julia Butters), who portrays the kidnapped Mirabella Lancer. Dalton later forgets his lines during a scene with Stacy (Olyphant). When Perry appears as Maunder/Scott Lancer on screen in Once Upon a Time in Hollywood, he attempts to safely recover Mirabella. Within the movie itself, the Lancer scene ends with Trudy praising Rick for his performance.

In real life, Maunder passed away in 2018 while Tarantino was filming Once Upon a Time in Hollywood. Four months after Maunder died, Perry tragically passed away in March 2019. He was 50 years old. Perry’s feature film career spanned nearly 30 years, and his television credits date back to 1982, including prominent roles in HBO's Oz and John from Cincinnati. Perry’s final Riverdale episode aired on April 24, 2019, which means that Once Upon a Time in Hollywood marks his last acting credit. Perry’s final performance underlines the traits that made him so appealing over the years: masculine but still gentle, always capable of stealing a scene with his charisma alone.

Next: Everybody Who Plays A Real Person In Once Upon A Time In Hollywood