As much as possible, if you find your guns have fallen off, either by going into the minefield or being shot off by players. You -shouldn't dock-. Otherwise they will be lost forever....
Cris is right here, you should quickly go to a planet/star and kill yourself then you'll have no trouble getting your guns back.
Happened to me some time ago, quite a pain to buy the guns especially if you bought them in a guard system.