"Ghost Town" is a welcome surprise: a supernatural romantic comedy that works, graced with a cast just off-center enough to make it distinctive. It may be too easygoing for some people. But - hate to reduce it this way - I laughed quite a lot and cried a tiny bit, near the end there, and I didn't feel as though the director and co-writer David Koepp, who shares screenplay credit with fellow Wisconsinite John Kamps, was working me over and calculating the living daylights out of each and every scene.

It's set in a lovely, autumnally inviting Manhattan, photographed in rich russet and golden tones by Fred Murphy. New York City looks so good the ghosts don't want to leave. This is the dilemma for Dr. Bertram Pincus, D.D.S., the sour, snappish loner played by Ricky Gervais of " The Office" (the British one, the one utterly unafraid of causing audience hilarity and pain in equal measures). A freak accident during a routine colonoscopy takes Pincus to the other side for seven seconds. When he comes back, things aren't the same; now he can see and hear all the spirits of the dead caught in limbo with unfinished business on their open-ended agendas.

One such spirit is played by Greg Kinnear, who spends the entirety of "Ghost Town" dressed in a natty tux. In this version of Manhattan afterlife, whatever you die in, you stay in. Kinnear's Frank Herlihy has left behind a widow, Gwen, played by Tea Leoni. Herlihy starts tailing Pincus and eventually reveals his request: If Pincus can bust up Gwen's imminent marriage to a human rights lawyer (Billy Campbell) her late husband believes isn't good enough for her, then he'll leave Pincus in peace.

This paves the way for an unlikely alliance between the dentist with the long-chilled heart and the archeologist, Gwen, with the irresistibly raspy voice and unerring comic topspin, not to mention excellent dramatic chops. I am pretty much sold on Leoni's skills in any film, but here she gets a fuller range and better scene partners than usual. None of the major characters in "Ghost Town" are particularly easy to like at first, and that's to the film's benefit later on. When Gervais finally gives in and agrees to assist various supporting ghosts in their respective projects - the earthly things that have been nagging at them - the film deepens and becomes unexpectedly moving.

The plotting loses some steam in its middle third, but Gervais makes a fine sourball. He's a sourball with a motormouth. Pincus cannot suffer fools gladly, himself included. My favorite scene, one of my favorites of the year, finds Pincus trying to get a straight answer out of his profoundly passive-aggressive young surgeon about what happened during the checkup to cause him to be plagued by spectral Manhattanites. Kristen Wiig, who was so remarkably droll as the undermining TV network staffer in "Knocked Up," works wonders with Gervais here. Double talk and hesitant, half-formed sentences rarely sound so ticklish to the ear.

Director Koepp isn't best known for comedy, and at times you sense "Ghost Town," as well-crafted as it is, searching for the optimal tone. I wish the whacked-by-a-bus sight gag weren't shot (and then repeated) in a way recalling a dozen other whacked-by-a-vehicle sight gags, either in features or commercials. There's a scene missing, I think, in which we see Leoni's Gwen falling for the dentist with the mouthful of bile. Yet key moments work very well. "I want to know why I wasn't enough for him," a distraught Gwen says to Pincus, once she's convinced he really has had conversations with her late, cheating, unreliable husband. Leoni and Gervais have genuine dramatic instincts, and this is why "Ghost Town" - a classy diversion, nothing more - succeeds in its shift toward pathos where so many other ghost comedies have failed. Also, Koepp lets his performers share a wide shot more often than is usual these days. The payoff is clear: When actors are allowed to interact in an ensemble piece, even a film with its share of nods to "Topper" and "It's a Wonderful Life" ("Wanna help me earn my wings?" Kinnear asks Gervais) can establish its own personality.