Bill Murray comes across as the Art Carney of his time in “St. Vincent,” doing a curmudgeonly routine that one could imagine Jackie Gleason’s old sidekick having pulled off a half-century or so ago. Of course the crotchety fellow he plays turns out—no spoiler here—to have a heart of gold, however tarnished. That means that the movie possesses a schmaltz quotient that would set a cloyingness detector off the charts. But Murray’s irascibility, even at the most mawkish moments, is enough to save the picture from drowning in a sea of sentimentality.

Still, there’s another reason why the film overcomes the threat of turning into sappy pabulum—Jaeden Lieberher, the kid who plays Oliver Bronstein, the tyke whom Murray’s drunken, gambling-addicted Vincent McKenna befriends after the boy moves next door with his single mom Maggie (Melissa McCarthy). By avoiding the extremes of blandness and obnoxiousness, Lieberher comes across as a pleasantly ordinary youngster, neither ostentatiously precocious in standard sitcom fashion (though the finale in particular shows that he’s really smart), nor droopily timorous. He and Murray make a pretty good team.

The plot—which is just an excuse for Murray to do his thing—has Maggie reluctantly agreeing to let Vincent babysit Oliver after school while she’s away at work, although she’s not certain that the abrasive, foul-tempered reprobate is up to the task. But though the coot’s influence on the boy is hardly benign—he takes the kid to the race track, teaches him to whip bullies and introduces him to Daka (Naomi Watts), the pregnant Russian pole dancer who visits him regularly—the two develop a genuine bond. Vincent even lets the boy accompany him on his visits to Sandy (Donna Mitchell), a woman at a retirement home where his attitude changes to one of affection and concern.

The rapport between the two will hit a definite snag, however, when Vincent’s need for cash causes him not only to raid the bank account he’s established for Oliver from their winnings at the track, but to use the cash in a risky bet that puts him in serious trouble with his bookie (a virtual cameo by Terrence Howard) and lands him in the hospital. His understandably foul mood after his recovery—which involves a turn in Sandy’s condition—ruptures the understanding between him and the boy, but only temporarily. In response to an assignment about modern-day sainthood imposed by his teacher, a voluble priest played with zest by Chris O’Dowd, Oliver researches McKenna’s past with surprising results. His findings help bring about a heartwarming finale, but one that still allows Murray an opportunity to deliver some biting remarks that help to dilute essentially saccharine material. There’s also a turn involving Oliver’s father that adds a dose of reality to what could have been a sugar-coated finale.

That brings up another virtue of “St. Vincent”—the natural, unforced performance by McCarthy. She brings a note of humor to the part, of course—she could hardly do otherwise. But she doesn’t shoot for the rafters, as she usually does. It’s hardly a subtle turn, but it’s a comparatively understated one that works nicely in this context. Watts, by contrast, elects to go very broad indeed (in all senses of that term), and pulls of even Daka’s turn to homemaker status toward the close. And O’Dowd, who’s been hit-and-miss in previous roles, invests the priest with a measure of loud-mouthed charm.

It helps everybody that while there’s never any doubt where Theodore Melfi’s script is going to wind up, it contains enough swerves and nimble dialogue along the way to compensate for the predictability. And his direction—backed up by solid technical contributions from cinematographer John Lindley, production designer Inbal Weinberg, art director Michael Ahern, set decorator Jasmine Ballou (who had a field day with McKenna’s living room) and costume designer Kasia Walicka Maimone, as well as editors Peter Yescher and Sarah Flack—offers Murray ample leeway to strut his trademark shtick. That includes some great moments of comic slapstick, most notably a scene early on in which Vincent drives over his own fence before repairing to his kitchen, where his bumbling attempt to get a drink leaves him sprawled on the floor. It’s a great physical bit that isn’t really matched later in the film, but Murray still keeps things percolating nicely, though at slightly lower temperature.

“St. Vincent” could have become just one of those “very special” TV-level movies that mix comedy and pathos, and admittedly its mean-old-grouch-and-lovable-child scenario is nothing new. But Melfi and Murray raise it well above the norm, making for a sweet fable with a tangy undertone to give it some spice.