Loss of Cabin Pressure and Potential Bullet Damage
In the meantime, the loss of cabin pressurization creates a problem for everyone on the plane. A commercial airliner flying at 30,000 feet (9,144 meters) is flying slightly higher than the peak of Mount Everest. The air at this altitude is so thin that a person will become incoherent in a matter of a minute or so without supplemental oxygen. That's why the oxygen masks will drop from the panel in the ceiling. If you're in this situation, putting the mask on quickly, while you're still thinking clearly, is important.
If the bullet hits wiring (or worse, if the bullet hits something important like the instrument panel in the cockpit), it could cause problems that range from trivial (in-flight entertainment stops working) to severe. The damage depends on what gets hit and how important it is.
Finally, there's the problem of the fuel tanks. Commercial jets store a lot of their fuel in the wings, but there are also tanks in the fuselage (or body of the aircraft) on many planes. For example, a 747 stores thousands of gallons of fuel in the fuselage. If a bullet were to puncture a tank, it would at least cause a leak and would have some potential to cause an explosion.
From this discussion, you can see that, in general, it's not a good idea to be shooting guns on airplanes! But if you have to do it, try not to hit anything important.