In “Tootsie,” Teri Garr perfected the polite way to say you had a bad time at a party. Bidding a friend good night, her character, a struggling actress named Sandy, tells him, “It was a wonderful party, my date left with someone else, I had a lot of fun, do you have any seconal?”

She sounds sunny as she’s saying all this and barely takes a breath. It’s a master class in comedic despair.

Garr, who died Tuesday at 79 from complications of multiple sclerosis, turned the neurotic basket case into an art form. On paper a Teri Garr role could be written off as a daffy blonde, but in her hands she gave these women depth and made them entrancingly funny.

Garr came from a show business family — her father was a vaudevillian, and she arguably inherited that can-do spirit of performing. Though she had appeared in a number of television shows and films throughout the 1960s, including as a dancer in multiple Elvis flicks, she was introduced to most audiences in Mel Brooks’ “Young Frankenstein” (1974, not currently streaming), playing Inga, the laboratory assistant to Gene Wilder’s Frederick Frankenstein. (Don’t mispronounce it.)

Brooks first presents her lying in the back of a hay wagon. She’s beautiful and busty, but immediately lands her first punchline.

“Hello,” she says seductively, in her ostensibly Transylvanian accent. “Would you like to have a roll in the hay?” Wilder pauses, taken aback by her apparent forward proposition. She interjects, brightly. “It’s fun!” She starts flinging her body around, singing, “Roll, roll, roll in the hay.” She doesn’t mean the sexual innuendo — or maybe she does.

Inga, like everyone else in “Young Frankenstein,” is a stock character with a zany twist as Brooks plays with the tropes of classic horror. She’s the sex symbol, of course, but it’s also clear that Garr is in on the joke. She knows she’s supposed to wiggle for the camera, and she does so with purpose, turning Inga’s gasps and jumps into gags, never letting herself be window dressing while Wilder and more established performers like Cloris Leachman and Madeline Kahn have all the fun.

Despite the creepy goings-on in “Young Frankenstein,” Inga is actually more calm and collected than many a Garr creation. Take Sandy in “Tootsie” (1982, available on major platforms), a part that won her an Oscar nomination for best supporting actress. She is a bundle of nerves, the quintessential stressed-out actress who never thinks she’s good enough. But Sandy’s pain, which Garr understands all too well, is that she actually has every reason to be as paranoid as she is.

After the party, she enlists her pal Michael Dorsey (Dustin Hoffman), another actor, to help her prepare for an audition for a soap opera. While she is eventually rejected for the part because she’s not “right physically,” Michael, knowing her fate, decides to dress as a woman and steal the role, becoming Dorothy Michaels and zipping to fame.

Sandy, who has been romantically entangled with Michael, suspects he is hiding something from her. When she gets too close to the truth of his cross-dressing TV stardom, he tries to throw her off with a different truth: that he’s in love with another woman.

Garr stands up and lets out a piercing scream. She starts yelling at Michael as if finally letting out all of her bottled mania. “I never said ‘I love you’; I don’t care about ‘I love you.’ I read ‘The Second Sex’; I read ‘The Cinderella Complex’; I’m responsible for my own orgasm. I don’t care!” she shouts, once again stuffing a million thoughts into one statement. “I just don’t like to be lied to.”

As she puts on her jacket to storm out, Garr plays it as if Sandy knows she’s giving the greatest performance of her life, one rooted in real feeling, the kind she has trouble mustering onstage or in an audition room. She lets loose, her bangs quivering above her eyes as she challenges Michael, and while it would be tempting to label this the rantings of a nutty woman, you can’t help but feel that she’s actually the sanest person in the entire movie, someone who at least embraces her neuroses and insecurities.

This isn’t to say that Garr couldn’t play truly kooky when she wanted to. That’s the beauty of her performance, just a few years later, in Martin Scorsese’s “After Hours” (1985, also on major platforms). When her bar waitress Julie invites Griffin Dunne’s hapless yuppie Paul to her apartment for a “TV dinner,” she seems as if she might be a safe haven. He’s soaked from the rain, stranded in SoHo and needs refuge.

Garr gives Julie a goofy sweetness at first as she puts on the Monkees and starts dancing. But there’s a desperation just itching to get out, and when Paul makes a snide remark, she explodes.

Suddenly her cheery disposition is gone, and she’s on the verge of tears as she rants about “people today.” It spirals as her own self-loathing trickles out, and she babbles about people who mock her and think she isn’t smart. It’s a little terrifying to Paul, and to us.

Still, there’s an ultimate sadness about Julie, a lonely creature of the night who has tried to make her apartment a retro pink paradise with a rainbow on the cupboard, but who is ultimately consumed by her isolation. She is perhaps not the brightest bulb, but Garr realizes that the knowledge of that is destroying her.

Garr wasn’t only funny — just witness the pain in her eyes as the worried wife in “Close Encounters of the Third Kind” (1977, on major platforms). And yet she was a wonder as a comedian, putting her own spin on women who could easily be defined by stereotypes. She didn’t so much try to subvert those stereotypes as mold them into something completely new. She did that with her wild eyes and easy physicality, but also by knowing that even ditsy blondes with low self-esteem have souls.