If you're sure it's Star Trek, there is one case of all the "reverse the polarity"s that contains all the pieces, and yet never uses the phrase. The scene it occurs in also popped into my mind upon reading the question, but because the phrase is never used it took a while to find.
In TOS 3x14, That Which Survives the magnetic seal on the fuel flow is ruptured. (A few minutes later, Scotty also refers to it as a "magnetic flow". However, we know from later series that the "fuel" is actually antimatter, which could be neutrons (and yes, antineutrons exist!))
Scotty goes into the "service crawlway" (also known as a Jefferies tube) in order to seal the rupture, during which time Spock performs an analysis on the ship to try and figure out why the ship felt different to Scotty.
The results are that the Enterprise was reassembled by a molecular transporter slightly out-of-phase, and Spock tells Scotty that "reverse polarity should seal the incision".
The specific image that came to mind upon reading the question was this scene:
So yes, Scotty reversed the polarity of that tool in order to seal the rupture on the fuel/antimatter/possibly antineutron flow.