Shot in the dark here -- whatever kind of flies they are (I bet fungus gnats, they're the ones you often see flying around houseplants and stuff. They like damp places and decaying matter), need a place to eat and breed. I sincerely doubt they are using your water, so it has to be something on your tank.
I would be cleaning every spot on outside of the tank that I could possibly get to, with bleach if it can be taken off and rinsed well enough. . .
When was the last time you thoroughly cleaned your filters? Not the bio media, not that, but the housing and stuff? Inside and out? Take your Eheims out, open them up and smell them. Do they smell "normal"? You know, like an aquarium? I'd clean them thoroughly. Check the bio media as well. That could possibly be a source. Take a whiff and see if it smells funny. If you are not sure, take some of the media put it in a jar plop the lid on tight and leave it for a day or two. If gnats develop, there you go.
Light fixture(s)? I've noticed algae inbetween the glass and the plastic on mine in a few places. Where algae can get, so can decaying fish food. Dunno what kind of lights you have. Worth a look. I'd wash what is washable in a light bleach solution and rinse rinse.
Canopy? Same as lighting. It's easy to drop fish food anywhere and it will get wet and rot.
Or, possible someone dropped something on the floor behind the tank that is rotting?
Personally, I would narrow it down as much as possible to the outside of the tank, but I think there's something in your filters or in that area.
My 2 cents
Roan