Sounds a bit like it might be a Ground loop on the Printer.
Open Console in Utilities & see if there are any clues or repeating messages when this happens.
Sounds to me like you are either disturbing the power to the Mini DisplayPort or actually moving the Mini DisplayPort plug causing it to lose connection
I suggest getting a Mac compatible 4 or 7 Port Hub to hot plug your printer and other USB devices into. That way you will not have to reach around to plug in USB devices and/or disturb other connections.