"oh?"
Hopefully that will beckon her/him to stop; since if they said the initial 'compliment' after they walked past you, by the time you respond they might've been out of hearing range. And since you had to ask here, you're probably often victim to esprit descalier. But the "oh?" will hopefully make them turn around/slow down, and give you enough time to haul the wit back over the staircase.
Adapt from there. Don't rush as after you say "oh?" and they turn around, they are expecting something from you, so you can afford to stare them for a couple of moments while you think. These couple of moments can also be used to decide whether the person is worth the strategy.
Since you asked, i'll assume you arn't the type who can get away spot free with a fedora. But it's fine as most arn't.