A 9mm, buck shot, or even a 556 (which they are not using on a sub) is not piercing the pressure hull of a submarine. That's before considering all the other mass of metal and matter within the sub.
Technically firing a .50 / 12.7mm should be fine for the hull even with API.
Bulkheads are thick.
(Note: SynTech / frangible ammo preferred)
Just thinking through Navy issued small arms. Lots of M4s and M17/M18.