A disappointing reunion for Brian Cox and Paul Dano, considering how good their first collaboration, Michael Cuesta’s “L.I.E.” (2001), was. It’s easy to understand why both actors might have been drawn to writer-director Dagur Kari’s “The Good Heart.” It has the feel of a carefully constructed short story, and offers both of them parts that afford the opportunity to show off—one through sheer flamboyance and the other through small, almost minimalist but nonetheless eye-catching gestures. Unfortunately, the story comes across as a theatrical contrivance, ending with a twist that seems preordained from the start, and the two characters at the center of it are little more than pawns in a writing exercise. To a certain extent it’s fun to watch Cox and Dano do their duet, but there’s no depth to the lyrics.

Cox is grizzled, irascible New York barman Jacques, who suffers his fifth heart attack when he becomes furious over an ineffectual anti-stress audiotape. He winds up in the hospital next to Lucas (Paul Dano), a homeless naif brought in after having tried to commit suicide. They become unlikely friends, with the blissful simpleton enduring Jacques’ imperiousness. When they’re released, Jacques announces that he’s taking on the young man as his protégé, destined to take over the bar when he dies. He gives Lucas a room and begins to teach him the trade, which includes not only making drinks but treating the place’s regulars with an appropriate blend of customer service and hostility.

What happens isn’t surprising. Jacques’ bad ticker starts to melt under the influence of the good-hearted Lucas, however much he might resist. (He even decides to give a reprieve to the duck he’s purchased for Christmas dinner.) And the patrons grow more chummy too. But a fly steps into the ointment in the person of April (Isild Le Besco), a sad-faced French girl who wanders into the place one night, just having lost her stewardess job because she’s afraid of flying, and is taken in by the ever-helpful Lucas. That infuriates Jacques, especially after her presence begins to change the character of the bar. And it leads to a showdown between the men.

It isn’t hard to foresee where “The Good Heart” is going to wind up, especially after Jacques is told he’s going to need a transplant to survive. And there’s a certain degree of pleasure in watching it get there, thanks to Cox and Dano. The former, his hair long and scraggly and his eyes sparkling, revels in barking out orders and issuing naughty insults. (He doesn’t really seem like a person suffering from a serious heart disorder, but illness is rarely portrayed credibly in films.) Dano is one of our most remarkable young actors—“There Will Be Blood” certainly proved that—but he gravitates more often to wispy little independent pictures like this, ones that only occasionally succeed as a whole (“Little Miss Sunshine”). Here he fashions a typically sensitive portrait of a fragile, gentle soul who’s easily dominated by others; every move and inflection seems carefully chosen to contribute to the effect. The result is affected but affecting, too.

But both men are working in the service of a script that’s undeserving of the effort they lavish on it, under direction that lacks firmness and tension. And the supporting cast is mostly a grubbier version of the old “Cheers” crowd. Technically things are reasonably good, with a bar set that’s full of character (the production design is by Halfdan Pederson and the art direction by Linda Stefansdottir and Matthew Munn), although Rasmus Videbaek’s cinematography accentuates the grubbiness a bit overmuch.

“The Good Heart” strives for warmth and charm via a heavy dose of whimsy and quirkiness. But as the little kitten featured at the beginning of it learns, being cute isn’t always enough.