Many insects can walk on water because they are light enough not to break the surface tension of the water. Don't know if a fly can do this.
Other insects can carry a bubble of air underwater with them to help breath underwater, but I doubt that most flies can do this.
The other thing to bear in mind is that a fly is cold blooded, which combined with its simplicity, means that it can significantly reduce its metabolism, so can survive in a dormant state in situations where higher organisms would find their more sophisticated and finely tuned metabolisms compromised. As a simple example, you can normally put an insect into a fridge, and it will go to sleep, and then wake up when you warm it up again, while humans would simply die of hypothermia (although mammals that are capable of hibernating would probably survive).