If you equip an extra gun with the "Extra Weapon Mount" ship upgrade you can sell the upgrade and still retain the functional gun
Here I had 2 Extra Weapon Mounts so Five Quad turrets total then sold one to buy a sensor suite, but I retained the five guns.

