When you have never met someone (or have no way of knowing the person, e.g. on the phone), どちら様ですか is how to enquire for someone's name/identity. When the circumstances/your memory suggest that you have met before, but you simply don't recall who they are, どちら様でしたか is more natural.
(Note that, by extension, you can also use どちら様でしたか in the first case by defaulting to the situation that you simply didn't remember any encounter, assuming a fault in your memory. Putting yourself (and your family) down is considered polite in many other situations. どちら様でしたか also less direct (it's referring to a possibly hypothetical past event) than どちら様ですか and thus can be considered more polite.)
Here, どちら様でしたか "Excuse me, but who were you again?" is slightly more polite than どちら様ですか "Excuse me, but who are you?", because it allows for the main character to simply not remember the previous encounter.
This is especially true since the circumstances seem to suggest that the main character met the woman before, since she seems confident enough to call him by his name (rather than asking すみませんが、X様ですか).
Asking どちら様ですか is more direct and might be (mis)understood to be carrying the nuance of "I definitely don't know you" suggesting that the woman is rude by not introducing herself first.
In a word, the main character is handling the situation in the most courteous manner possible.