An unlikely romance is set against the seedy environment of the Nevada casinos in Wayne Cramer’s charmingly quirky “The Cooler,” a little comedy-melodrama with lots of heart, some harshness and menace and plenty of laughs besides. Though this Las Vegas fairy tale is far from flawless, it benefits from a superlative cast that coasts over the cliches so ably that they almost seem newly-minted.

William H. Macy is a perfect nebbish as Bernie Lootz, a sad sack with a bum leg who has for years worked in the Shangri-La, the last of the old-fashioned gambling spots in the city. The Shangri-La is managed by Shelly Kaplow (Alec Baldwin), an old-timer who resolutely resists any changes in his operation; and one of the most antiquated of his methods is to use Bernie, who’s about as uncool as one could imagine, as his ironically-named cooler–a fellow whose luck is so miserable that he can “cool down” a big winner at a casino table simply by standing beside him and sharing the doom. As the picture begins, however, Bernie’s let Shelly know that he intends quitting soon–having finally paid off an unspecified debt to the boss after years of service. Bernie’s plans change, however, when he finds himself in something he never expected–a late-life romance with Natalie (Maria Bello), a waitress who unaccountably comes on to him. As that relationship heats up (and eventually takes a turn that won’t come as a complete surprise), Bernie is confronted by another complication–the sudden appearance of his long-lost son Mikey (Shawn Hatosy), an inept con-man accompanied by a pregnant girlfriend named Charlene (Estelle Warren), who soon has to be rescued from Shelly’s wrath by Bernie. In the end, though, Bernie’s luck magically changes–and Shelly finds out that perhaps he’s been standing near his cooler too long himself.

The story could easily have slid into mawkish sentimentality, but Kramer and his performers dextrously weave comic touches into it, giving it surprising lightness despite the presence of beatings and mob brutality. Macy is the key; once again he paints a memorable portrait of a little lost soul whose pathetic quality doesn’t become irritating. But he gets great support from Bello, whose naturalness is a wonderful complement to his slightly artificial style. And Baldwin, who shows once again his strength in character roles, makes Shelly a genuinely scary guy who nonetheless has a note a nasty integrity to him. (There’s a nifty subplot about his loyalty to the over-the-hill crooner, played by Paul Sorvino, whom he continues to employ in the casino lounge.) To be sure, the whole business about the challenge to Kaplow’s regime posed by the M.B.A. mentality of the owners has a “Godfather Lite” air to it, but Baldwin actually manages to carry it off through sheer bravado. The Hatosy-Warren material, on the other hand, is weak, and the two youngsters haven’t the degree of skill needed to salvage it; Hatosy, in particular, gives a sadly unshaded performance.

Technically the film is at best competent, a trifle ragged around the edges but watchable. But the style somehow seems appropriate to a picture about lovable losers who nonetheless come out, like “The Cooler” itself, on top.