I'm trans so I have special experience here, I guess...
Whenever I get misgendered I have three options:
1) Say nothing.
2) Immediately correct them.
3) Correct them if they continue to do it.
You have to figure out how much it bothers you. Usually if I'm say... talking to a vendor that I'll never speak with again, I just ignore it. It's not worth the bowing and scraping and apologizing that follows.
If I correct people right away I usually say something like "Actually, it's ma'am.", or just interject "She" right after they say "He" or whatever. I have yet to have a single person say anything beyond "Oh okay sorry"... if they start falling over themselves to apologize excessively I usually add "Don't worry about it, it happens all the time, its no big deal." to put them at ease. My goal is to clearly communicate my expectations without placing blame on them.
Sometimes I'll decide to say nothing, but it will keep coming up in the conversation and I will decide to correct them. This is usually the most awkward way to go about doing it - there's always a pause where they count up in their head how many times they misgendered me already. I try to stick to the same non-confrontational attitude with this, but it's always at least a bit awkward.
So I'd say either correct them right away politely and try to downplay it (after all, they're not trying to insult you or anything) or don't say anything if it isn't worth the effort.