How does Hades (Greg Germann) know Zelena (Rebecca Mader)? That’s one interesting tale! Episode 16 of “Once Upon a Time” Season 5 revealed a backstory Sunday night that shakes things up.

The episode begins with a flashback to Oz “many years ago.” Zelena wants to create a time-travel spell, but she needs some key ingredients — like the heart of the Scarecrow. Fortunately for the Scarecrow, Dorothy (Teri Reeves) shows up in the nick of time to save him. The Munchkins had spread the word that Zelena was alive and back ruling Oz, and Dorothy returned to stop her.

Thanks to Toto, Dorothy rescues the Scarecrow and escapes the castle. But Zelena is bent on getting revenge and creating her spell. She goes to visit the Munchkins to find out who spilled the beans to Dorothy, and is confronted by Hades. He heard that Zelena is trying to create a spell to time-travel and wants to help. Unfortunately for him, Zelena’s not too interested in joining forces with anyone.

Hades eventually resurfaces and changes Zelena’s mind when he tells her about his desire for revenge on his brother, Zeus. Zeus had cursed Hades and stripped him of love. Only the gift of true love has the ability to restart Hades’ heart and free him of the curse. The only problem for him is that no one is “more hated” than the ruler of the Underworld. So, why does he want to use Zelena’s time-travel spell? To go back in time so that he ends up on Olympus and his brother suffers.

Zelena likes that Hades wants revenge, and accepts his help. He takes her on a bike ride and the two share a moment. But then it’s right back down to business. Hades explains that all she needs to do to find Dorothy is enchant the bike.

The enchantment works and Zelena uses her magic to freeze Dorothy before pulling out the Scarecrow’s brain. Zelena is ecstatic, but when she turns back around, Hades is gone.

Meanwhile in the Underworld, Hades wants Gold (Robert Carlyle) to open a portal in Storybrooke and bring someone from the living down — Zelena and Robin Hood’s (Sean Maguire) baby. Why does he want their baby? That’s one secret he’s not willing to expose just yet.

Gold opens the portal in Storybrooke to get the baby. Things don’t exactly go as planned, though. Despite Regina (Lana Parrilla) sending her away, Zelena somehow made it back to Storybrooke. She’s in the middle of fighting with Belle (Emilie de Ravin) and Mother Superior (Keegan Connor Tracy) over the baby when the portal opens up in the nursery. Belle grabs the baby and gets sucked into the portal. Zelena jumps in after her, leaving Mother Superior alone with baby Neal.

A confused Zelena and Belle find themselves in the Underworld. Belle is still holding on to the baby, and Zelena wants her back. She knows that Hades brought them there because of her daughter, but Belle has no intentions of handing the baby over. With Zelena’s magic gone and her foot injured, Belle takes off with the baby.

With nowhere else to go, Zelena shows up at Snow (Ginnifer Goodwin) and David’s (Josh Dallas) apartment to get help. She tells everyone about the portal and how her baby is in danger. Robin Hood and Regina spring into action, determined to find her before Hades does.

The good news is that the baby is still safe with Belle. While trying to navigate the Underworld, Belle seeks shelter at the Underworld’s version of the town library. Once inside she discovers Gold. He didn’t realize she got sucked into the portal and is happy to see her. But he’s got some important stuff to discuss with her.

Gold explains that he opened the portal to get Zelena’s baby for Hades. Belle is confused as to why he would do it — and how he could do it. Gold explains everything, from her being pregnant, to him making a deal to give up his second-born child, and even becoming the Dark One again. Belle is horrified, but Gold drops a bombshell on her. She fell in love with a man and a beast. She made him a better man, but she can’t make him a different man.

Belle has a lot to think about, and leaves Gold behind. Shortly after leaving Gold, she runs into Robin and Regina in the woods. She returns Robin’s baby to him, but is confused when Zelena shows up. Regina explains that Zelena is helping them, and they decide to extend that trust to allow her to feed the baby. That plan backfires when Zelena briefly regains her magic and uses it to take off with her daughter. It’s not until she gets away that she realizes that her magic hurt her child.

Desperate to protect her from any more harm, Zelena decides to hand the baby over to Robin and Regina. She begs them to save the baby and explains that Hades wants to use her for the time-travel spell. The baby is a symbol of innocence.

Regina and Robin are grateful for Zelena’s sacrifice, and agree that the best thing for the baby is to hide her in the woods. Meanwhile, Snow decides it’s time to go home. She tells the others they’re going to save themselves and take down Hades.

But there is something else they don’t know. A final flashback reveals that Hades disappeared in order to prepare a special dinner for Zelena back at her castle. He confesses that he’s no longer interested in pursuing revenge and that his heart fluttered for a moment when they were on Dorothy’s bike. He wants Zelena to kiss him so that they can be free together. But Zelena doesn’t believe him. She thinks he’s trying to trick her by stealing the time-travel spell for himself. She tells him to return to the Underworld, and Hades does so — but not before telling her she will regret it.

Cut back to the Underworld and Hades runs into Zelena on the street. He wasn’t trying to steal her baby to hurt her. He reveals he made Gold open the portal so he could get Zelena’s daughter back for her. Although she never returned his love, everything he did was for her. That’s even why the Underworld looks like Storybrooke. He made it for her.

“Wouldn’t it be nice to not be alone anymore?” he asks her. “What better revenge is there than having it all?”

But Zelena doesn’t have it all now that she gave up her daughter. Hades says they could get her back together. However, Zelena knows what darkness could do. She tells him she needs to do it on her own. He promises he’ll be there waiting for her when she’s ready.