Well, what I am describing now is not for the fainthearted and probably shouldn't be done, but I had to do something to save a Tung Sol BGRP tube (12SN7).
The tube is labeled Arcturus with a date code of 3/4 - perhaps April 1943. The little heat radiator clip above the top mica had come loose, and I did not want it to cause a short.
By taping on a little 4mm magnet on the top of the tube glass I was able to position the clip away from any internal structure.
It is a very small and not very strong magnet:
This inelegant contraption actually works - the tube glow is nice:
For some reason the addition of the magnet and the tape seems to magnify the tube glow for a spectacular night effect:
BTW, the other use I found for these little magnets (apart from refrigerator use) is to use them to connect test leads and wires.
Now, about the solution to a loose metal piece inside a tube the magnet may work, but I would be leery of using it long term - not worth it if something would happen to your equipment.
Homework: What are the differences between magnets rated N35, N42 and N52?
PS: Decided to test a very strong magnet that I have on a couple of tubes. This magnet is so strong that I have to wrestle it off a flat ferrous surface. I was worried that it might pull off the anode caps but on the two tubes I tried nothing happened - apparently the anode caps are not ferrous at all. Same thing with the tube pins - no magnetic attraction. However, the internal shrouds in the tubes were ferrous, but because of the distance from the glass to the inside shroud on ST type tubes there wasn't much of a pull.
This tube is suspended in the air, held by the magnet - looks scary, eh?
Don't worry, I only used tubes from my BTB (Busted Tube Box) - have about 20 such tubes...
In conclusion, I have no idea of the effect of a strong magnetic field on a tube, but I don't think that the tube will be damaged by a strong magnet.