It could have been an exercise in gloom, but "The Inevitable Defeat of Mister & Pete" has a spunky spirit that keeps despair at bay. This story of castaway kids has a playful energy to balance its sense of real-life peril. It's like an "Our Gang" comedy directed by Spike Lee.

Mister, a scrappy 14-year-old firecracker from Brooklyn's housing projects, has failed eighth grade. He's stuck baby-sitting 9-year-old neighbor Pete, whose mom is AWOL. He wants independence more than anything. Then he gets it, as his drug-addicted mom (played by Oscar winner Jennifer Hudson) is arrested.

Without adult supervision, outside help or money, the kids pull together, relying on each other to make it through a summer heat wave in their crime-ridden high-rise. As their circumstances darken, their bond deepens.

While the kids face tough realities, they're too young and hopeful to surrender to the child protection authorities, and the film is too humane to place them in serious danger for a cheap thrill. Just when the film threatens to break your heart (the way Hudson pays off her son's restaurant lunch tab is devastating), there's another example of his young heroes' never-say-die resilience.

They're never exploited for sentimentality. As the boys, Skylan Brooks and Ethan Dizon are a natural comedy team. They display priceless on-screen chemistry, whether the scene calls for anger, kindness, confusion or vulnerability. They're called on to carry most of the film on their slender shoulders, and they triumph.

There's a pack of notable actors around the film's edges — "American Idol" winner Jordin Sparks as a Good Samaritan ex-neighbor, Anthony Mackie as the fearsome boss of the area's street thugs, Jeffrey Wright as a homeless veteran. Director George Tillman Jr. keeps the action percolating with a lively sense of New York street theater. When the boys visit an expansive upscale supermarket, the camera surveys it as if they have stepped into Oz.

This is an impressive piece of grass-roots filmmaking. The script by Twin Cities writer Michael Starrbury is a gem, juggling rounded characters, suspense, irrepressible humor and surprising revelations. He hasn't written a kids' movie (it's rated R for profanity), but he understands the skewed premises and limited perspectives of young minds. He has created a smart, grown-up dramatic comedy that happens to be about preadolescents.