David Hyde Pierce simultaneously plays off and upends the persona he so memorably created as Niles Crane in the long-running “Frasier” series in Nick Tomnay’s “The Perfect Host.” He stars in the twisty thriller as Warwick Wilson, a sophisticated, punctilious fellow whose modernistic Los Angeles home is invaded by a bank robber on the lam from the police. But the crook’s expectations—and the viewer’s—are soon confounded.

Australia-born Tomnay, in a recent Dallas interview in connection with the picture’s opening-night premiere at the USA Film Festival, explained that “Host,” his debut feature, was an expansion of a short simply called “The Host” he’d made in 2001. “It’s fleshed out more,” he said. “It’s a deeper analysis of these characters. The end of Act II was the end of the short. And it’s American.”

Tomnay explained that the short was set in his hometown of Sydney. “The interesting thing,” he added, is that when I was making the short, people in Australia would comment that it didn’t seem like an Australian film. I think that’s because it could happen anywhere, any larger city. Transplanting it from Sydney to L.A. wasn’t that difficult.”

When it was pointed out that the title was also expanded with the word “Perfect,” Pierce interjected, “That’s me.”

How did he get involved in the project?

“My manager sent me the script, and the short,” Pierce said. “And I loved them both–loved the writing in the feature, and the style and the performances in the short. So we met for lunch, and just chatted about what it would be, and that’s it. And also it’s a great character, obviously—that was one of the things that made me intrigued. I thought in the right hands, this would be a lot of fun to work in.

“It was intended to be literally [a different role for me] in the sense that the character starts out in a way that is not that different from the way people, especially people who know me from ‘Frasier,’ are used to seeing me, and allows me to depart from that and go into very different directions.”

One of the ways involves some song-and-dance routines that take the actor into the Broadway musical territory he’s specialized in since “Frasier,” with appearances in both “Curtains” and “Spamalot.” (He also recently hosted a big birthday celebration for Stephen Sondheim, broadcast on PBS and available on DVD.)

“That was in the short,” Tomnay said. Pierce added, “And it was interesting to me that it was, because even in the shorter version the mix of tones in the film—the darkness and the humor—was all there. And I think that’s also one of the reasons why it asked for expanding. It had so much compacted into that short script that it allowed for richer exploration.”

Another aspect of the film the writer-director and star discussed was the style, which Tomnay explained was based on David Hockney’s L.A. paintings. “I’ve always had a great deal of fascination with that kind of stuff,” he said.

“Which is interesting,” Pierce added, “because David Hockney’s stuff is very bright-colors and light and clean lines, and the idea of a Gothic David Hockney is what he did.”

Writing about “The Perfect Host” is dangerous because so much of its effect depends on the surprises sprung on the audience by its narrative twists. But as Tomnay explained, much of the effect comes from Pierce’s playing the lead.

“At the beginning of the film, I think that you know a lot about Warwick,” he said. “I think that the audience assumes that they know everything about this character. But by the end of the film I think you know very little about him.”

“The Perfect Host,” a Magnolia Pictures release, is now available via Video on Demand.