"In Purgatory's Shadow" is the 112th episode of the television seriesStar Trek: Deep Space Nine, the 14th episode of the fifth season. The first half of a two-part episode, it is most notable as the beginning of the Dominion invasion of the Alpha Quadrant. It features the return of several familiar faces, drawing on plot lines previously established in the third, fourth and fifth seasons. It was dedicated "In memory of Derek Garth", a grip on the set of Deep Space Nine who died in an automobile accident.
When the station picks up a mysterious coded message from inside the Gamma Quadrant that appears to be Cardassian, Garak is asked to analyze it. He reports that the message is insignificant, but is later caught trying to sneak off the station in a runabout. He then admits that the message is some sort of distress call from his mentor Enabran Tain, the former head of the Obsidian Order. Garak convinces Sisko to allow him to travel to the Gamma Quadrant to search for Tain (and possible Starfleet, Bajoran, Romulan, and Cardassian survivors from Dominion attacks), but Sisko sends Worf along as a "chaperone".
Garak and Worf bicker constantly and find nothing. Finally, Worf announces that they can go no farther and takes the ship out of warp, explaining that the source of Tain's signal is deep in Dominion space. Garak, however, is unwilling to give up, and pushes Worf to travel through the nebula to avoid detection. Worf reluctantly agrees, and almost immediately upon entering the nebula, they wind up in the midst of the Jem'Hadar fleet.
Worf realizes that the entire fleet can only be assembled for one reason — they intend to invade the Alpha Quadrant. He immediately sends a warning message to the station, but is not confident it will get through. Moments later, four Jem'Hadar soldiers materialize on the ship and take Worf and Garak prisoner. Back on Deep Space Nine, the crew is able to decipher enough of Worf's signal to realize the Dominion is coming. Sisko sends Kira to find Worf and Garak, but they are already imprisoned in a Dominion detention center, where they are told they will remain until they die.
Inside the camp, Worf meets Martok, the Klingon general who was replaced by a Changeling. Martok leads Worf and Garak to Tain, himself a prisoner, who is dying. Instead of being thankful to Garak for coming, Tain chastises him for allowing himself to be taken prisoner. Meanwhile, Kira returns with grim news that at least 50 Dominion ships are headed their way. With reinforcements at least two days away and only Gul Dukat on hand to help out, Sisko sees only one choice — sealing the wormhole. If Worf and Garak don't escape in 36 hours, they will be trapped. Meanwhile, Worf and Garak are introduced to another prisoner: Bashir ... meaning that the Bashir at the station is a Changeling.
On the station, the Bashir Changeling begins making himself useful to Dax and O'Brien while they work out the technology that will seal the wormhole. In the internment camp, Garak meets with Tain again, desperate for a kind word from his mentor before the old man passes on. When Tain makes Garak promise to escape as a final request, Garak makes a request in return — that Tain acknowledge him as his son. He does, and father and illegitimate child share a memory before Tain dies peacefully. His mission complete, Garak is ready to find a way out. But he may be too late. On Deep Space Nine, the crew shoots a particle beam at the wormhole using the emitter array, intending to close it. However, something goes wrong. The emitter array has been sabotaged, and the wormhole remains open, allowing a fleet of Jem'Hadar ships to begin pouring through.