The U.S.S. Enterprise arrives in an uncharted area of space to answer a distress call from the U.S.S. Defiant. The starship is visible on their viewscreen, but sensors on board the U.S.S. Enterprise say it's not there.
Kirk, Spock, McCoy and Chekov beam aboard and spread out to investigate. Everyone aboard is dead ... apparently killed in a bizarre mutiny, although there are no life readings aboard. McCoy, in the ship's sickbay, tells Kirk that he can find no clue as to why the crew died, but has taken readings to study. Then, as his hand passes through a body and exam table, McCoy realizes the U.S.S. Defiant is dissolving.
Quickly Kirk orders them beamed back to the U.S.S. Enterprise, but Scotty explains that due to the poor stability of the space around them, he can only beam three aboard. After the usual debate, Kirk stays behind while the others beam back. When Scotty tries to bring Kirk aboard, his image wavers, and disappears. Interphase, Spock calculates, will occur in a little over two hours. In the meantime, they must wait. If the captain is still alive, they should be able to retrieve him then.
Complications arise when Chekov goes berserk and attacks Spock on the bridge. Slowly, more members of the crew fall prey to the "illness," attacking their crewmates. McCoy and his staff work round the clock to find a cure. When the doctor suggests Spock "put some distance" between the U.S.S. Enterprise and the U.S.S. Defiant, Spock explains that any movement in the weakened space could disturb both ship's positions and jeopardize Kirk's rescue.
At a little over an hour before interphase, a Tholian ship appears, telling Spock that the U.S.S. Enterprise has violated Tholian space. The Vulcan explains that they were answering a distress call and are waiting until they can retrieve Kirk. The Tholians agree to wait until the appointed time before taking action.
Unfortunately, when the interphase occurs, Kirk is not where he should be. Spock suspects that the Tholian's entrance into the area of space disturbed the U.S.S. Defiant's position. A funeral service is held for Captain Kirk, following which McCoy insists they view the Captain's last orders. Spock reluctantly agrees and the two men go to their friend's quarters and listen to Kirk's touching advice.
Uhura is the first to see Kirk's image floating before her, and for a time, McCoy thinks she's contracted the disease. But when he and Spock see Kirk on the bridge, they realize that he is, in fact, still alive.
The Tholians decide that Spock has, in fact, lied to them and opens fire. Making a decision, Spock orders the phasers fired at the ship. The Tholian ship is disabled, but soon another ship joins it and they begin 'building' a sort of web made of shining filaments. Spock analyses the web and announces that if they don't bring Kirk aboard and leave before the web is completed, they "won't see home again." At the last minute, Spock orders full power against the web and the U.S.S. Enterprise is thrown outside the Tholian's trap, several parsecs from their former position. The hope is that Kirk, caught in the U.S.S. Enterprise tractor beam when they changed position, was brought with them.
Tensely McCoy waits with a hypo of tri-ox for Kirk, whose air is running out as he's successfully beamed on board the U.S.S. Enterprise, alive and unharmed. In a humorous tag, McCoy and Spock convince Kirk that there had been no time to view his final orders and Kirk, somewhat disappointed that his wisdom had gone unheard, says that he hopes there isn't a similar circumstance where the two men will view the tape.