En route to the starbase, the Enterprise stopped at Gamma Hydra IV where Captain James T. Kirk and the other senior officers were infected with a radiation disease that caused premature aging. This forced Stocker to assume command of the Enterprise.
As acting captain, Stocker violated the Romulan Neutral Zone, in an attempt to take a shorter route to Starbase 10 in the hopes of reaching the base, and its "superior" facilities, in time to save the afflicted officers. This led to an attack on the Enterprise by several Romulan Bird-of-Prey. Being an inexperienced officer in battlefield conditions, Stocker panicked and almost lost the Enterprise before the cured Kirk could retake command and save the ship, using a broken code to deliver a false message warning Starfleet ships to avoid the area after he detonated the corbomite device (by the time the Romulans realized they had been fooled, the Enterprise was safely back in Federation space).
Understanding that he had been in no shape for duty, Kirk held no ill will toward Stocker, though he did insist that there was little a starbase could do that a ship could not - which the commodore admitted he was now well aware of, assuming the right person was in command. (TOS: "The Deadly Years")