Ma opens with a vision of disappointment. U-Haul trailer in tow, newly divorced mom Erica (Juliette Lewis) and her 16-year-old daughter Maggie (Diana Silvers) roll into a small town that promises nothing but boredom. Erica is returning to the home she left years ago for the promise of California. Maggie is seeing it for the first time, and she approaches the place with an appropriate sense of resignation. It isn’t San Diego, but they can’t afford San Diego anymore.

When Erica gets a job at a nearby casino that keeps her away from home at odd hours, Maggie falls in with some kids who get their kicks drinking at the rock quarry, because what else is there to do? And when middle-aged veterinary assistant Sue Ann (Octavia Spencer) agrees to buy them booze and offers the slightly more appealing option of partying in her basement, Maggie and her friends jump at the chance. When you’re this bored, why not? And when your host asks you to call her Ma, and then starts acting weird, well, maybe that’s just the price you have to pay to make the boredom go away.

Directed by Tate Taylor (The Help, Get on Up), the new horror movie Ma is messy in ways both large and small — sometimes to its benefit, sometimes not. But it gets the details of a certain kind of small-town life right. It’s set in a place where everyone knows everyone else, high school humiliations stick around forever, and teenagers wind up unwittingly or unwillingly falling into the same roles their parents played before them. Ma’s characters — most of them deeply unpleasant — snipe at each other in jest (but not really), express themselves via frequently homophobic insults, and patronize Sue Ann, even as she goes out of her way to accommodate them. For them, the disappointment of their hometown is still new, and defined more by dullness than pain. For Sue Ann, it’s the place where she first knew loneliness and humiliation, and the years have only intensified those feelings. And for this, her new friends will soon pay a price.

Without giving too much away, Ma ultimately reveals itself as a kind of time-release take on Carrie, but without the supernatural elements. Sue Ann’s kindness and permissiveness take on a creepy edge long before her teenage guests start to suspect she has her own agenda. After first leaving Maggie and company to their own devices in her basement, making them promise they won’t take the Lord’s name in vain or try to come upstairs, Sue Ann starts to party with them, dancing and drinking with them when they show up at her house, and texting them when she’s lonely. The party basement lets her be the popular teen she never was, but it also lets her plot revenge.

As might be expected from an actress who frequently finds depths in roles both large and small, Spencer takes the chance to get beneath her character’s skin, playing Sue Ann as simultaneously insane, justifiably angry, unnervingly empathetic, and unexpectedly glamorous. She seems to take real pleasure in dancing with the teens and dressing up for drinks, which lends her an air of tragedy, even as her behavior becomes increasingly disturbing. She commits monstrous deeds, but she never quite seems like a monster.

In interviews, Spencer has said she took the lead in Ma — a reunion with Taylor, who directed her in The Help — because it not only offered her a chance to appear in a horror movie different from those in which “black people always die in the first 15 minutes,” but because she’d get to kill people, a rarity for a black woman in a genre film. (Spencer speaks from experience; her character doesn’t make it out of Rob Zombie’s Halloween II alive.) As originally scripted by Workaholics writer Scotty Landes, Sue Ann was white.

But even though Ma’s race is rarely mentioned explicitly, it wraps itself around the themes of the film. Maggie’s friends, only one of them black, treat her condescendingly and quickly decide to discard her once she becomes too demanding, as if they’ve been taught that some people deserve more respect than others. In flashbacks to Sue Ann’s high school days, she appears to be the only black kid in her school, and she’s surrounded by white tormentors.

Watching Ma, it’s hard not to wish it either gave Spencer more space to work through some of the character’s contradictions over the course of a more thoughtful drama (with some killing thrown in for good measure, of course), or that it went all-in on being a trashy exploitation film that let the blood and social commentary flow freely. Instead, it tries to walk a middle road in addressing its racial angle, and the timidity doesn’t always serve it well. Taylor dutifully checks all the genre’s boxes — including the now de rigueur scenes of the villain using social media — but he isn’t particularly adept at building suspense or keeping up the story’s momentum. Weird loose ends, like the murder of a major supporting character that takes place on-screen and in graphic detail, then goes virtually uncommented upon for the rest of the movie, start to become distracting.

But while it’s ultimately a sloppily put-together shocker, having Spencer at the center makes it a memorable sloppy shocker, one that lets a black woman take her revenge out on the innocent and the guilty alike, and comes this close to treating it as justifiable. Taylor understands how small towns operate, by ostracizing people who don’t fit in, while cycling one generation after another through the same boozy rites of passage, and Spencer’s Sue Ann becomes just the sort of restless avenger such a place deserves. Maybe the only cure for nastiness, injustice, and endless boredom is to burn it all down.