While Sisko, Kira, and Dax investigate readings of unusually high thoron emissions coming from the plasma field in their area of space, O'Brien reads his daughter Molly a bedtime story about Rumpelstiltskin, after which the mystical dwarf actually appears in her bedroom. Shocked, O'Brien discovers that not only does he seem real, he doesn't disappear when his name is spoken as in the fairy tale. He calls Sisko on his combadge, but Sisko has become otherwise preoccupied when he finds himself face-to-face with Buck Bokai, a long-dead baseball player who has come to life from Jake's holosuite game. An even more shocking surprise greets Bashir, when he is awakened in his quarters by the caress of Dax's hand, then finds her trying to uncharacteristically smother him with affection. The senior officers are then summoned to Ops, where they are joined by Rumpelstiltskin and Bokai. Sisko asks Dax if this phenomenon could be connected to the thoron emissions, but she seems confused by the question. Suddenly, the officers hear a voice from behind, and turn to see ... another Dax!

Bashir's tricorder analysis confirms that the three newcomers are definitely not holograms, but quite real. Sisko surmises that all of them were born of imagination, the thought of which makes the new Dax even more flirtatious with the embarrassed Bashir. Suddenly, Odo's voice breaks through to tell them that it is snowing on the Promenade, while in Ops the three fantasy characters mysteriously disappear one by one. Dax's analysis of the plasma field reveals that its wave fronts are converging toward a single point; whatever falls in there just disappears. While Sisko orders a probe prepared to investigate, Odo finds the snow gone, but now an alien animal is running loose, and Quark is walking with his arms around two affectionate, scantily-clad women. The Ferengi is quite happy, until he sees his patrons are fulfilling their fantasies by winning big at the dabo table. In the science lab, Dax and Bashir learn the wormhole is helping to make the rupture in space larger — and the tension between the two is increasing as well, especially after the new Dax appears to taunt the original. All this stops, however, when the computer discovers that a similar rupture formed in the Hanoli star system in the twenty-third century — and Dax recalls that when the rupture exploded, that system was destroyed.

The probe is launched, but while the officers work to gather data, O'Brien is annoyed by Rumpelstiltskin's return, and the dwarf strikes a raw nerve by hinting at a threat toward O'Brien's daughter. The probe's analysis from the center of the anomaly reveals that it's getting larger. While they deal with this new development, Sisko finds himself cultivating a more personal rapport with Bokai. Later, the three products of the imagination meet privately, with Rumpelstiltskin and the new Dax baffled as to why they are being rejected by those who first thought of them. But Bokai reveals that he has found a soft spot in Sisko, and that because of this, they should continue to stay — for as long as it takes.

Sisko, Kira, O'Brien, Dax, and Bashir meet and decide to prepare a pulse wave torpedo for the purpose of trying to seal the rupture, even though that tactic was unsuccessful when a Vulcan science mission attempted the same thing in the Hanoli system. O'Brien is betting the more sophisticated version they can use now might be able to contain the internal reaction. Sisko sets O'Brien to the task — but if the plan fails, the entire Bajoran system could be destroyed. Preparing for the worst, Kira goes to coordinate evacuation of the pylons, but encounters a section on fire, from which emerges a man ablaze, who comes toward her but then disappears. Meanwhile, Odo tries vainly to control the situation on the Promenade, and finds brief satisfaction when his imagination conjures an image of Quark in jail, while Jake tries to resist Bokai's temptation to desert his homework and play ball. In Ops, Dax reveals that the rupture has expanded dramatically, and the rate of expansion is increasing. She puts an image of the rift on the viewscreen, and everyone — including the three fantasy constructs — watches as the phenomenon sucks in space matter all around it.

O'Brien launches his altered photon torpedoes into the rupture, and the rift swallows up the detonation. Their instruments show they aren't getting a controlled collapse; readings inside the rupture are off the scale. Suddenly, an intense flash, then a massive hit throws everyone to the floor, including the fantasy Dax, who hits her head in the fall. The sensors are knocked out, and while O'Brien attempts repairs, Bashir tends to the new Dax, who can't stay conscious. When the sensors come back on line, they reveal the torpedoes have had no effect. Then, Rumpelstiltskin pipes in with a suggestion — he'll close the rift in exchange for O'Brien's daughter. The suggestion infuriates O'Brien, who grabs the dwarf. But Sisko has finally put together the pieces of the puzzle — the entire rupture is a product of their imaginations, and he drills that thought into his officers. True to his belief, the rift vanishes, as well as the three fantasy beings. Later, the danger gone, Sisko sits alone in his office, when Bokai reappears, and reveals that he and his companions are beings on an extended mission exploring the galaxy. They traveled through the wormhole recently, observing, gaining understanding, and explains that only the powerful imaginations on the station placed everyone into inadvertent jeopardy. Then, Buck mysteriously disappears before he tells Sisko where they came from ...