What was arguably Psych’s best cameo was Val Kilmer’s shocking guest appearance in the Psych series finale. Psych’s eight-season run on USA was littered with pop culture references that were usually related to actors and movies from the 1980s. The two movie stars that Shawn (James Roday Rodriguez) talked about the most were Billy Zane and Val Kilmer. The former was used as Psych’s final villain, while Kilmer was given a brief cameo.

Psych’s last episode dealt with Shawn’s struggles with telling Gus (Dulé Hill) that he was leaving Santa Barbara for San Francisco to be with Juliet (Maggie Lawson). Apparently, Shawn avoided telling everyone goodbye, and instead left farewell video messages for his friends, including Gus, Lassiter (Timothy Omundson), Woody the Coroner (Kurt Fuller), and a character named Detective Dobson, who had never been seen on the show before that moment. As noted by both Shawn and Dobson, the two had never really spoken to each other, but Shawn admired him regardless. When the video is interrupted by Lassiter, it’s revealed that Dobson is played by none other than Val Kilmer himself.

Related: Psych: The Movie's Original Plan (& Why It Changed)

James Roday Rodriguez has talked in the past about the process of getting Val Kilmer on the show and why he was brought onboard for the finale [via EW]. Detective Dobson had been name-dropped by characters at the SBPD through all eight seasons, but since his face was never shown, his absence played up the mystery of who he really was. It was decided that the longer this went on, “the bigger the payoff it would be” to finally show him. So to create the “ultimate gift to the fans”, they pursued Val Kilmer for the role.

Psych Shawn Gus Season 2

Rodriguez explained that Dulé Hill had a friend with a connection to Kilmer. After speaking to him via phone, Hill “put him on the spot” and asked him directly about appearing on the show. He agreed, but Rodriguez and Hill had to go a step further to get the cameo to happen. At this time, Kilmer was doing a cross-country show tour show called Citizen Twain, and Rodriguez attended one of the shows in order to have a face-to-face with Kilmer. After getting backstage, he “laid it on” and went through Kilmer’s assistants and his agent until that they were able to get the cameo worked out. According to Rodriguez, Kilmer may have cooperated because it was easier than continuing to deal with them.

The scene that was shot with Kilmer became one of the last season’s most memorable moments, due in part to how much Kilmer was talked about on Psych. Shawn Spencer regularly expressed his appreciation for Kilmer, and it was revealed at one point that he even had the actor - a person who he had never met - listed as his emergency contact. All of this was reflected in Kilmer’s cameo, especially when Shawn called his character “the kind of guy I could have worshiped as a child. And an adolescent. Well into my 20s.”

More: Psych 3 Can Resolve A Season 8 Mystery By Bringing Back Pierre Despereaux