Here’s a really good example: Marilyn Monroe in Love Happy, opposite Groucho Marx.
That’s the extent of her appearance, just a couple of minutes and a couple of lines supporting a dumb comedy bit. But she really did swipe the movie, because it’s utterly terrible, deservedly forgotten (and I speak as an avowed Marxist, there’s nothing to defend here), and she stood out in comparison. Afterward, people wanted to know who that was. She’d previously had a couple of other throwaway roles, but this was the one where she was first noticed. The following year, she was granted a couple of more serious opportunities, and from there rose quickly to stardom.
I was going to say that I think cameo roles which are a punchline unto themselves should be disqualified. I’ve seen a few cases where the audience laughs more at “OMG it’s that actor and I can’t believe they got them for just this scene.” which seems to me like lazy screenwriting (“Well, we could craft a brilliant punchline, or we can just have [million watt megastar] walk through the frame and save ourselves the hassle.”) But then a lot of the examples I could come up with didn’t include dialogue, hence don’t qualify as per the OP. Like (spoiler, I guess, for a movie that’s four years old) Brad Pitt in Deadpool 2, and (in a return favor) Ryan Reynolds in Bullet Train.
But back to the topic, I loved Rick Moranis as the gravedigger in L.A. Story. Chevy Chase also has a funny cameo in that one, uncredited for some reason. And Patrick Stewart as the snooty Maitre D’ kills it in his scenes.
Dame Judi Dench got a Best Supporting Actress Oscar for her portrayal of Queen Elizabeth I in “Shakespeare in Love.” Her total screen time was eight minutes. I think that fits the OP pretty strongly.
He may have been in more than once scene, but Neil Patrick Harris in the back seat of Harold and Kumar’s car is literally the only scene I remember from the movie.
My prime example of this is the pretty rotten Robin Hood with Kevin Costner. At the end of the movie, good King Richard returns to England to restore justice to the land.
It’s Sean Connery.
The audience I was with burst into applause, which I found ridiculous, because even though Connery could obviously play the role beyond an uncredited cameo, they were applauding for Connery the actor, not Richard the king. Gimmick casting.
Those are all good, but see if you can find John Lithgow’s deleted scene from L.A. Story. He plays superagent Harry Zell who has a meeting with Harris in an outdoor restaurant. He arrives by jetpack.
Scott Bakula filmed some scenes as Harris’s neighbor, which also found the cutting room floor.
I’d say that one is more justified, because Connery had played Robin Hood onscreen in the past, so it was a callback, not unlike Lou Ferrigno showing up in both big screen Hulk movies. Whether most of the audience in 1991 knew that is up for debate, I’ll give you.