Hardpoints get rendered first, turrets last.
Within those, larger weapons get rendered on top of smaller ones.
Within the same size, missile weapons get rendered on top of non-missile ones (mostly useful within hardpoints, if you have two turrets of the same size overlapping, there's a good chance of it looking bad whichever way you go).
Beyond that, I wouldn't count on any render order produced by changing the order of the weapon slots in the hull or variant spec. It's unpredictable, even if it happens to be stable in a given build.
Just as a general note, in most cases, overlapping weapons is going to look a bit weird. It tends to break whatever illusion of volume the shading on the sprites creates. In some cases, overlapping is very hard to avoid - such as with a large turret swinging around - and that's why those render on top of everything else.
Hmm... if you really need it, I think I could add alphabetic sorting based on the weapon slot id, within the subclasses (i.e., "large non-missile turret" or "small harpoint").