Fish poop out of a point on their bellies near their tail. However, food can, and does, come out of gills from time to time. You probably just saw some of his dinner popping out of his gills! Also, flaring can be stressful to bettas, so I wouldn't try the mirror thing again. While one flare is certainly not dangerous, stress and exhaustion happens from flaring, so there's no need to keep doing it.