Be relieved: Will Ferrell’s rookie attempt at drama is a movie nearly as charming and rewatchable as “The Truman Show.” Let’s just hope that Ferrell isn’t donning a Seussian green felt costume three or four years from now.

But even if Ferrell doesn’t manage to ruin the film, there’s still an inherent risk in making a movie like “Stranger Than Fiction,” which tells the story of a man who finds himself trapped inside the plot of a famous author’s latest novel-in-progress. As an offbeat postmodern jaunt into metafiction, the film runs the risk of getting carried away in its own intellectual pretensions and ending up too offbeat and too postmodern — in a word, too cerebral. Plenty of movies are capable of challenging their viewers, and Hollywood is in the very business of tugging at the heartstrings, but the movie that can do both in a genuine and convincing fashion is rare.

“Stranger Than Fiction” may fall just short of convincing, but it at least combines intelligence and emotion with enough tact to make for an enjoyable viewing experience. As stimulating as its initial premise is on its own, “Fiction” also recognizes the need for nuanced, well-developed characters, and the result is a film with an elevated IQ and an endearing heart. It also contains some fine acting, news which ought to come as a relief to those apprehensive about Will Ferrell’s crossover into a more serious role.

Ferrell plays Harold Crick, an IRS agent whose life seems governed by cold calculation and blinding routine. For all of Ferrell’s accolades as an off-the-wall funnyman, his deadpan reserve works startlingly well in the context of Crick’s lonely existence. One day, Crick arises to discover that he is being followed by a mysterious female voice that narrates his life, as he puts it, “accurately, and with a better vocabulary.”

The voice, we learn before long (though Harold does not), belongs to a famous novelist named Karen Eiffel (Emma Thompson), who is in the process of writing a novel, “Death and Taxes,” in which Harold himself is the main character. Each sentence she writes on her typewriter echoes concurrently in Harold’s head — even though she has no clue that he is, in fact, a real person. Eiffel, determined to kill off her main character by the conclusion of the book, is a nervous wreck because she cannot decide on the precise mechanism of Harold’s demise.

The normally-luminous Thompson looks especially frenetic and haggard on-screen, and her performance as the chain-smoking, neurotic genius Eiffel may well be the most gratifying element of the film. Less compelling are the actual words her character speaks — or writes — in Harold’s imagination. Eiffel can turn a few clever phrases and make the occasional insight, but most of what’s supposed to pass for brilliant prose is simply tepid. It may sound great when spoken in Thompson’s British lilt, but would any major literary figure really begin a sentence with, “Little did he know…?”

Through the narration, Harold learns of his eventual demise, and he visits an array of therapists — one of whom is played, briefly and inexplicably, by Linda Hunt — to determine what he ought to do. Eventually, he walks into the office of Dr. Jules Hilbert (Dustin Hoffman), an expert on literary theory at a local college who is perennially seen drinking copious amounts of coffee or eating bananas. Dr. Hilbert employs a series of amusing diagnostics to investigate which plot Harold seems to be stuck in, but he is ultimately unable to offer much help. The best he can do is advise Harold to begin living his life to the fullest.

In response, Harold attempts to shake up his own existence by learning to follow his dreams and his emotional instincts, which include buying a Fender Stratocaster and pursuing a relationship with Ana Pascal (Maggie Gyllenhaal), the headstrong bakery owner whose tax returns he is auditing. Ana’s character is apparently supposed to be feisty and charming, but in truth she is more obnoxious than anything else, spouting antigovernment vitriol and initially telling Harold to “get bent.” And when Harold perseveres, winning her over with kindheartedness and simple charm, her rather sudden transition into an adorable, doting maiden is a bit too much to believe.

Still, Harold ends up learning a valuable lesson about the importance of embracing each day and living with passion — one only wishes that there were something more profound to be gleaned than that learning to play the guitar leads to happiness. “Stranger Than Fiction” may not be Will Ferrell’s usual laugh-riot slapstick humor, but it is a comedy with considerable depth and feeling — much like the comedy that Harold’s literary existence turns out to be.

n Stranger Than Fiction

Dir: Marc Forster

Columbia Pictures