So far there is an answer with one example of a player who needed 9 matches to win an ATP tournament - three in the qualifying and six in the main draw. It was Roberto Carretero - he won 1996 Hamburg Masters,
Did that happen also in WTA tournaments? I suppose that there aren't many tournaments which have three rounds of qualifying and six rounds in the main draw. And of course, if this happend it would be one of the qualifiers who won WTA tournaments.