@Emerson
Sounds like several episodes of star trek at least one in TOS (the M5 one) and I think dreadnaught which had cardassian missile with built in AI, that managed to trick Tores in to thinking she had re-programmed it, and convinced the AI they were no longer in the Alpha quadrant.