Practical Joker, The
On a routine mission surveying type-4 asteroids, the Enterprise is attacked by a trio of Romulan warships. The Romulans claim that the Federation ship has passed into their space. To avoid the conflict, Captain Kirk orders his crew to take the Enterprise into a nearby unknown energy field, thus evading the barrage of weapons-fire from the warships.
Unfortunately, subatomic particles from the energy field seep into the Enterprise's computer systems and affects its functions. Soon, the altered computer has become a practical joker, first by ruining a diner for the command crew by providing leaking glasses and bendable utensils, then by placing a microscope on Spock's duty station that gives him inky black eyes, and even by pelting Scotty with food and a cream pie from the food dispenser. Amused at first, the crew soon grows tired of the pranks, and begins blaming each other.
Spock soon theorizes that the ship's computer is behind the gags, but not before one deck's floor is covered in ice, and Helmsman Sulu, Dr. McCoy, and Lieutenant Uhura become trapped in the Recreation Room's Holodeck. Things get worse as gravity is shut off on the ship, and laughing gas floods the breathable life support oxygen. Scotty struggles to reroute the ship's logic circuits, to no avail.
When the Enterprise computer returns the ship to the Neutral Zone, the Romulans gear up to attack again. But then, the computer releases a giant-sized inflatable Enterprise, which fools the Romulans momentarily. Kirk tricks the computer into taking them back into the energy field that infected them. The Enterprise computer is returned to normal, but the pursuing Romulan ships are now infected with the same subatomic particles, now wreaking practical jokes on the humorless Romulans.