"Operation Mongoose" is a two-part episode, comprising the twenty-first and twenty-second episodes of Once Upon a Time. It was written by Edward Kitsis and Adam Horowitz. It is the final episode of the fourth season, and premiered on May 10, 2015.
The tower where Emma is held is featured in the Forest in part 1; A swan is featured in part 2.
Our World, 1966
At a television shop, we find Isaac Heller (the Author) as a struggling writer trying to sell color televisions, until he gets a letter from Star Publishing saying that he is wanted for hire. He arrives to find a mostly empty room, with the Apprentice at the desk, who then lays out a selection of different writing materials and demands that Isaac choose one as a test. Isaac picks the magic quill, which seems to approve of him in turn. The Apprentice creates a magic door to another realm, and both he and the Author go through it.
In Storybrooke (Before the Altered Events)
Emma, Hook, Henry, Mary Margaret, David, Regina, and Robin are in the library of the mansion, searching for way to stop Gold and Isaac from enacting a new reality with the newly activated ink. They are then joined by August, who shows them a drawing of the sorcerer's Apprentice, who might be able to help them. Hook remembers the Apprentice from when he and Gold trapped him in the sorcerer's hat. With the help of the Blue Fairy, they release the Apprentice, who immediately says that there’s no time to waste. He tells them that they must find the storybook page depicting the door, as well as the door's key, for only then will they be able to lock Isaac back into the book where he belongs. The group splits up, with Henry, Hook, David, and Mary Margaret heading back to the loft for the book and key, while Emma, Regina, and the Apprentice head to Gold's Pawn Shop.
At the shop, Gold is clinging to life as Isaac finishes up writing the new book, titled "Heroes & Villains." He plans on a new universe in the Enchanted Forest for the inhabitants of Storybrooke, while he writes a new ending for himself in the Land Without Magic. When he writes the final words, "The end," magic appears out of the book and begins to distort time and space.
Henry awakens with the key in his hand at the loft, but runs downstairs to find that Hook, David, and Mary Margaret have disappeared, along with the rest of the people of Storybrooke. He then drives himself to a restaurant in search of help, but notices a best-selling book on a shelf: "Heroes & Villains" by Isaac Heller.
Henry is able to locate Isaac at a book signing event, who is surprised to see him. Henry demands answers and Isaac reveals that his family is alive, but now exists in a different universe inside of his "Heroes & Villains" story, presenting Henry with the original storybook. Henry wasn't trapped along with the others because he wasn't born in a magical realm and he is also told that Emma wasn't either, as Isaac did not write a "savior" into the story. After Isaac refuses to undo the events, Henry takes the key and uses it on a page of the book, transporting himself and Isaac into the alternate universe.
The Alternate Universe
Henry and Isaac find themselves trapped in the final chapter of "Heroes & Villains." After Henry finds out that a happy ending for a hero in this universe will return things to the reality that he knows, Isaac leaves him to be attacked by a ogre. However, Henry is rescued by the "Ogre Slayer": Rumplestiltskin, a heroic knight. Using Isaac's book as a guideline, Henry seeks out Regina, who is living life as a bandit "Snow White" in this universe. He tries to convince her that he is her son, but Regina does not believe him and throws the book into a fire. Convinced that a true's love kiss between Regina and Robin could solve the problem, he suggests that she seek him out, although Regina already knows him as a fellow thief who is a major rival of her's.
Around the same time, Isaac, having escaped the ogres, searches for Henry, but ends up falling into a trap and is found by the evil dwarves, led by Grumpy, who take him to Snow White, who is now the "Evil Queen." Snow is also holding the heart that belongs to Prince Charming and uses it to command him with orders to behead Isaac, but Isaac schemes his way out of it by convincing them that he knows some of their secrets, since he wrote them in the first place. Isaac tells Snow that she can get her happy ending again (which was love with Prince James in this universe), if she agrees to kill Henry along with Regina.
Ignoring Henry's advice, Regina proceeds to rob the royal carriage, but when she opens the door, she is confronted by Snow. Regina is asked about Henry's whereabouts, but after she offers no intel, Snow prepares to kill Regina with a fireball until Robin Hood shows up and rescues her at the last second on horseback. He takes her back to his pub and tends to her wounds. The two drink to becoming new friends and declare their mutual respect for one another as outlaws in the forest, with Robin offering her leadership of his Merry Men. Regina starts to fall for him, but he then admits that he's leaving the thieving business in honor of his bride-to-be, who turns out to be Zelena. As she leaves the bar, she runs into Henry and informs him about the impending nuptials, which he realizes will mark the permanence of the alternate universe when the church bells ring. She then suggests that he try finding his other mother, if he truly believes that the "Heroes & Villains" tale is real. When Henry mentions that his other mother was known as "the Savior," Regina tells him of the legend of "the Savior," who was trapped in a tower in the middle of the ocean by the Evil Queen.
Rumple returns home to his wife Belle and their newborn baby son. Unfortunately, Isaac is there waiting and tells him that his happy ending is about to be taken away if a boy named Henry succeeds in his quest to reverse the events of the new book. As he is without his real memories, Rumple does not believe the story that Isaac is telling him about the book, until Isaac mentions Baelfire, a secret from his past that he's keeping from Belle. Isaac then tells him that he must thwart Henry and Regina's plan to stop Robin and Regina's wedding.
Meanwhile, Henry goes to the Jolly Roger to recruit Hook and finds that the pirate is now employed by Captain Blackbeard. With this reformed Hook lacking in bravery, Henry has to take care of Blackbeard himself before telling Hook that he must help him rescue his mother, Emma, from the tower. Henry and Hook sail towards the tower where Emma is locked away and proceed to knockout the dark guard on duty. When Henry reaches Emma at the top, he is surprised to find that she was able to keep her memories as part of a cruel curse. As the trio escape on the ship, Emma, while getting to know Hook, explains that the guard was none other than Lily, who has the ability to transform into a dragon. Emma and Hook are able to shoot her down into the ocean with a cannon before she attacks. When they make a pit stop at a village, the three are caught by Snow and Charming. Since Snow does not acknowledge Emma as her daughter, she plans to kill both Emma and Henry. Hook is unable to wield a sword, but tries to defend them anyway. He battles Charming, but is no match for the prince and is fatally stabbed in front of Emma.
Henry and Emma return to Regina's cave. She asks to speak with Regina alone. Emma tells her that if she tells Robin the truth about how she feels, everything will be fixed and they can both get their happy endings with the men they love, acknowledging that she never got the chance to tell Hook how she really felt before it was too late. The trio arrive at the chapel to stop the wedding, but before they can do so, Rumple suddenly appears to stop them. Emma and Henry try to distract Rumple as Regina tries to work up the nerve to interrupt the ceremony. Emma engages him in a swordfight, until he is able to knock her out temporarily. Rumple then aims his sword at Henry, but Regina jumps in front of him just in time to take on the hit herself, opting to save Henry instead of pursuing Robin. Moments later, Robin and Zelena are exiting the chapel and Robin rushes to Regina's side as Zelena's envy starts to take over, causing her to start turning green. Robin tells Regina that she won't have to die alone.
Isaac reappears and Emma demands that he restore everything back to normal, after socking him in the face. However, because Isaac broke the Author's code of never writing himself a happy ending, the quill no longer works for him. Henry then picks up the quill and it activates, meaning that he has been appointed as the new author. Using the blood of the "light savior," Regina's, Henry writes, "because of Regina’s sacrifice, Isaac’s villainous work was undone."
In Storybrooke (After the events are restored)
As everyone awakens from the events, Emma runs to Hook and is relieved to find him alive, though she is still unable to admit her love for him. Gold also wakes up in his shop, back to his dying state. Isaac leaves him there to head out of town. Belle then enters to shop and finds him on the brink of death. She confronts him about his actions as of late and tells him that he already had his happy ending with her before he threw it all away for power. Belle admits that she does still care for him and Gold begs her to go far, far away before his death is complete and only the Dark One remains.
Meanwhile, as Isaac approaches the town line, he is stopped by Mary Margaret and David, who ask about his motives for messing with stories as the author. Isaac tells them that a lifetime of bad bosses and others who pushed him around inspired him to hate "heroes" and side with the villains that he thought never got a break. At the same time, the Sorcerer's Apprentice tells Henry more about his new powers as the Author, which do not include the ability to resurrect the dead, such as Neal, since he died in the real world. He urges Henry to resist the temptation of embellishing stories with the quill and Henry responds by snapping it in half, saying that "no one should have that much power."
That night, the people of Storybrooke are all celebrating at Granny's diner. Lily tells Emma that she wants to find the identity of her father and plans on staying in Storybrooke during her search. All of a sudden, Belle shows up to tell everyone that the last bit of humanity in Gold's heart is about to turn black and the group finds Gold unconscious. The Apprentice then uses his power to pull the darkness out of Gold and transfers it into the Sorcerer’s Hat. He then puts a pure white heart back into Gold. However, the hat is unable to contain the darkness and it is unleashed into the Apprentice. Emma then uses her light magic to pull the darkness back out of the apprentice and the dark magic disappears out of the shop. As the apprentice lays dying, he tells Emma and Hook that the darkness must be tethering to a human soul that can be controlled with the Dark One's dagger and that the only person who can prevent the darkness from destroying all the realms is a sorcerer named Merlin, who lives in a place far away. The two then meet up with Mary Margaret, David, Regina, and Robin as they scour the streets of Storybrooke for the darkness, which then appears to attack Regina. Possessing the dagger, Emma volunteers to tether herself to the darkness to prevent it from destroying everyone and everything, telling her loved ones that she trusts that they'll find a way to separate the darkness from her once again. She finally tells Hook that she loves him as he implores to her against sacrificing herself, but she ultimately does so anyway. The darkness violently surrounds Emma and when it dissipates, only the dagger is left behind. As the shot zooms onto it, it now reads the name of the new Dark One, "Emma Swan."