I believe it refers to something completed using a rifle as a stereotype, old weapons had barrels that screwed into the receivers and were blued to protect against rust and finally marked as to the builder and the date made.
Trying to track down old phrases like this can be frustrating: I've spent quite some time at it. Both explanations make sense but I'm inclined to go with O.P.'s because my Dad was a gunsmith. I remember him blueing rifle barrels -- a dangerous process requiring cyanide as I remember. I'm not sure what "blued" refers to about being shanghaied unless it's an oblique reference to the blue ocean or a Navy blue uniform.