Found this explanation on a fermentation forum:
Re: fruit flies
Postby music on Fri Nov 08, 2013 9:01 am
Fruit fly carry acetobacter on their feet, the bacillus that will create a vinegar mother. Let them be for a while, then filter them out. Once they have created the mother, there is no further use for them, exclude them if you can, but they'll do no real harm. If you want to make vinegar from beer or wine, invite the fruit flies in for a party.