first of all, welcome to AA!!
A few things could be going on in your tank. First, when you say your ammonia was good, was it reading zero? And also you need to check nitrite and nitrate, nitrite more importantly. Second, algae treatments usually contain copper, and copper is toxic to fish. It casuses the
O2 to drop, hence your fish gasping at the surface. Plus as the algae dies it will consume even more
O2.
If your nitrite, nitrate, and ammonia are all in check (ammonia should be 0, nitrite should be 0 and nitrate should be no higher than 80), then I would suspect copper poisoining with the info I have. You should just break down this tank and start over. Clean it out thoroughly to remove all copper and any other toxins.
And remember, algae isn't toxic to fish, but algae treatments usually are. Using algae treatments doesn't solve the problem, it just masks the symptoms.