Dave Alvin is the first musical performer written into a script on the FX network. Alvin will appear in Wednesday's episode of "Justified," performing his new single "Harlan County Line." The song will be on his next album, which Yep Roc will release in June.

In the scene, which opens the third episode of the show's second season, two locals travel on a date to a bar to see Alvin perform. His name is mentioned four times before the first commercial break and more than minute of "Harlan County Line" is played on the show.

Though it's not the first time a musician has appeared on the Fox-owned cable network -Alanis Morissette acted in three episodes of "Nip/Tuck" - it is the first time Alvin has been cast in a TV show.

"I got a call out of the blue asking me do I have anything that might fit," says Alvin, who was putting the finishing touches on his 11th solo album since leaving the Blasters. "I thought I had something that would fit, nudged it lyrically and gave it to the director."

With the song "Harlan County Line" in their hands, the script was rewritten to have Alvin appear on camera performing the tune in a bar located in Harlan County, KY.

That "out-of-the-blue" phone call has its roots in backstage incident more than a decade ago. Alvin had performed at Jack's Sugar Shack in Hollywood and was asked after the show to autography a CD for Graham Yost, a television writer and producer who was a fan. Yost is executive producer and writer for "Justified," having developed the show from an Elmore Leonard short story. It stars Timothy Olyphant, Walton Goggins and Nick Searcy.