A loose American remake of the similarly-titled English comedy from 1960–not actually one of Ealing’ productions (that company had folded a couple of years earlier) but emulating their spirit–which starred Ian Carmichael as a young bumbler who enrolls in a school for one-upmanship run by Alastair Sim in order to outmaneuver his nasty rival Terry-Thomas, “School for Scoundrels” comes from the writer-director of “Old School” and “Starsky and Hutch” and stars Jon Heder of “Napoleon Dynamite,” neither of which bodes well. The natural assumption is that it’s going to be a raunchy, brainless farce aimed at adolescent males stumbling into theatres fresh (or not-so-fresh) from frat-boy keg parties.

In the event, though, the picture proves mostly a pleasant surprise. There are a few paintball shots to the crotch and a quota of dumb-guy humor, to be sure; bits by Sarah Silverman and Ben Stiller are a lot less funny that was clearly intended; the double and triple-dealing isn’t as clever as it might be; and the finale, which involves a sprint through airport security to a waiting plane and all sorts of shenanigans in the cabin prior to takeoff, has an almost quaintly retro feel in today’s more security-conscious world. But there’s an underlying sweetness to the movie that comes close to carrying it over the needlessly sophomoric touches and occasional comic miscalculations. Or to put it another way: it’s not as bad as you might expect–in fact, it’s mildly engaging. That might not be the strongest of recommendations–and it certainly won’t endear it to the yahoo crowd as though it were a Will Ferrell vehicle–but compared to what one can say about most Hollywood comedies nowadays, it’s a pretty good one.

In this reworking by writer-director Todd Phillips and his collaborator Scot Armstrong, Heder plays Roger, a shy, clumsy fellow who, as a parking patrolman in New York City, is easily bullied by those he’s trying to give tickets to. He’s also perpetually at a loss in the presence of a neighbor he’s infatuated with–Australian Amanda (Jacinda Barrett), whose sharp-tongued roommate Becky (Silverman) takes special joy in belittling him. He’s even fired as a Big Brother volunteer. In desperation he follows a suggestion to enroll in a secretive, expensive class for men with, shall we say, low self-esteem. It’s taught by the mysterious Dr. P (Billy Bob Thornton), a rude, abrasive fellow with a thuggish assistant named Lesher (Michael Clarke Duncan), who brutally berates his students and puts them through humiliation after humiliation with the stated purpose of transforming them from spineless doormats into something with at least a bit more backbone.

Among the pathetic types in the class, Roger actually stands out, to the extent that Dr. P selects him as a target for special destruction, not only for his own pleasure but also as a kind of classroom exhibit. The form his campaign takes is to woo Amanda, using every dirty trick possible to win her and outdo his erstwhile pupil. Ultimately Roger retaliates, enlisting a wild-eyed former student of the “doctor’s” undone by similar treatment in the past (Stiller), as well as several of his classmates (Matt Walsh, Horatio Sanz and Todd Louiso) in a complicated scheme to prevent Amanda from going off on a trip with the snarky teacher during which her good reputation will undoubtedly be compromised.

Though based, even if rather remotely, on a nearly half-century old British comedy that by contemporary standards would be thought a model of decorum despite its slapsticky nature, it’s easy to see how this rebuilt “School for Scoundrels” how have been transformed into something designed to appeal to the crassest instincts of an arrested-development audience. But for the most part it resists the impulse. There’s some distinctly adolescent stuff here–Heder does, after all, suffer a “swirlee” in a commode at the hands of a nasty co-worker–but most of the time the material is on a somewhat more sophisticated level, akin to what you’d find in the sort of comedies studios produced decades ago or those of today aimed at an older crowd. The result is uneven, a decidedly mixed bag that may disappoint both segments of the audience for different reasons. But in an age of appallingly coarse comedies, its relative restraint is definitely welcome.

And it surely gives Thornton an opportunity to do the surly shtick he’s perfected in pictures like “Bad Santa” and “The Ice Harvest,” and Heder the chance to take his loser persona into more agreeable territory than has previously been the case. (In fact, the places where his character goes momentarily awry are those in which he becomes too strong and capable too quickly. A tennis scene adapted from the first movie, for instance, happily doesn’t go as far as it might have, but still doesn’t have quite the right tone.) Along the way, Duncan ribs his muscular image decently, Barrett makes a nice-looking if rather colorless romantic target, Luis Guzman has a few good moments as Roger’s oddball boss, and the supporting cast of goofballs are moderately funny. On the other hand, Stiller, doing one of his patented crazy guys, and Silverman, trying to be a sort of modern-day Eve Arden or Thelma Ritter, come across as more irritating than amusing. The picture looks good–Jonathan Brown’s widescreen cinematography is generally crisp, and the New York locations are reasonably well chosen and used. Christophe Beck’s score is jauntily on-target, too.

In trying to satisfy both adults looking for something lightheartedly romantic and adolescents wanting another helping of raunchiness, “School for Scoundrels” could fail to connect with either. But that would be an unfortunate fate, and an undeserved one. It’s not a classic, but compared to today’s normal run of revolting comedies, it comes within reach of an old-fashioned gentility that’s quite winning.