I think it would be simpler to incapacitate a Star Fleet vessel by sabotaging its food replicators than fighting it out with shields and weapons. Are there safety mechanisms on replicators? If so, what are they? Can they be modified to include poison or other harmful substances in the foods they deliver?
Yes, and no. Yes, you could do this, with enough access to the replicator systems, just like any computer system can be hacked and changed with the right access, electronic or physical. No, it won't be easy. The replicator, much like the transporter technology it partially uses, scans for viruses and hazardous particles. It has restrictions on replicating weapons, poisons, uniforms. Some things are not programmed in at all, while others need permission or access codes to produce the items. Finally, you would need to program in the new pattern and default programming, requiring familiarity with the system. And you have to get to them, through shields and an army of yellow shirts and civilian notice.
Given the sheer amount of difficulty that Counselor Troi had just to get a frigging chocolate sundae, this seems, while possible, ludicrously difficult.