Sam Esmail tells THR that the USA Network thriller's latest casualty "was always in the cards," even if the timing was occasionally in question.

[Warning: This story contains major spoilers for season three, episode two of USA Network's Mr. Robot.]

For a show coded in chaos, Mr. Robot doesn't remove characters from the playing field lightly. Look at the biggest human casualties along the way as examples: Shayla (Frankie Shaw), Gideon Goddard (Michael Gill) and Cisco (Michael Drayer), all of whom were killed off in jarring fashion, fueling the story with an awful feeling that everyone's just a hair trigger away from a sudden departure.

Two episodes into season three, there's officially no better example of how Mr. Robot treats death as an act of unanticipated finality than the demise of Joanna Wellick, played by Stephanie Corneliussen — a staple of the series since its earliest episodes, often viewed as the Lady Macbeth to her husband Tyrell Wellick (Martin Wallstrom), the former E Corp. employee turned digital terrorist currently living in the shadows as the most wanted man in America.

Throughout the series, Joanna was positioned as a power player in her own right, fearless in her pursuit of her own goals, fierce in her role as the lone parent to her newborn son, enigmatic in terms of her standing within the greater Robot narrative. Now, the questions surrounding Joanna linger, even if she's decisively gone, killed by a bullet she barely saw coming. The killer: Derek (Chris Conroy), the jilted lover Joanna convinced to fool the world into thinking Sharon Knowles (Michele Hicks) was killed by her husband Scott Knowles (Brian Stokes Mitchell), instead of the actual perpetrator, Tyrell.

"We knew Joanna using this poor guy to essentially save Tyrell from the murder charges had to backfire," creator Sam Esmail tells The Hollywood Reporter. "As good as she is, we wanted Joanna to have that human flaw of underestimating this guy. It was also a bit of a class thing. She got overconfident and overzealous. She's the rich and powerful woman, and he's the lowly bartender she thinks she can play with. In the Mr. Robot universe, actions have consequences, and sometimes big ones. We felt there was something dishonest about letting Joanna get away with this — something too clean about letting Tyrell get off of the murder charges without a price being paid. That's how the story took us in that direction of Derek killing her."

While Joanna's death comes as a shock in the context of the episode, as well as the context of the larger Robot narrative, Esmail insists it was always a part of the plan. "We always go back to the story, and it came from that," he says. "There's no external factor here. We felt like we had told her story. Was it always in the cards? Yes. The timing was never pinned down, but when we started breaking this season, that's when we knew. The stars aligned, so to speak. We knew this was the right time."

As for the violent nature of the death — Joanna being shot in the head in front of her newborn son, her blood splashing upon his face, followed immediately by a scene in which Joanna's corpse is dissected on an autopsy table — Esmail feels it was warranted, given the Wellick family's own history of violence.

"The balance here is, look what Tyrell did in the first season," Esmail says. "For a seemingly irrational reason, he murdered a completely innocent woman. Now he's getting away with it scot-free. We felt that in terms of the justice of the universe, there was a price that had to be paid for that. That's our way of balancing it out, so to speak."

Even in the aftermath of her death, Joanna will remain a presence in season three. Without confirming whether the character will appear again in the future, Esmail says Tyrell's late wife will continue to hold an important role in his life. "He has yet to be informed of the news, and clearly that's going to take a toll on him. In that way, for sure," Esmail says. "Joanna was an important force in his life. Her death isn't going to go unnoticed with him. It will definitely have an impact on the story as we get towards the end of the season."

Until then, Mr. Robot fans are tasked with moving forward in the wake of the biggest character death yet — indeed, the first series regular to be killed off from the show. With that in mind, The Hollywood Reporter spoke with Corneliussen (next appearing in a recurring role on ABC's Deception) about her final ride as Joanna Wellick, including an inside look at what it was like to play dead both in the moment of the murder and beyond.

How are you holding up, first of all?

I mean, obviously we finished shooting a while ago, so it's been processed. But I was incredibly sad. In this sense, you could use the term "heartbroken." I was heartbroken. It was difficult, knowing in advance, and having to plan knowing when to shoot your death, of somebody who has become a part of you ... it was hard.

When and how did you learn about Joanna's fate?

Being an actor, you get super involved in the storytelling process, but in the end, we're not part of the creative decisions that are made by the people who make all of this possible. So I was informed around the time of season three starting up. Even though I was super upset and very heartbroken by the decision, I also know and respect Sam so much, and I know he has a purpose with everything he does. In that sense, I felt it was part of ... and I don't know what's next, this is all my speculation, but Joanna is a very manifesting presence. With everything that's going to happen in season three, I think it makes sense for her story to end here. I like to think of it as when you say sometimes you have to kill your darlings. I hope that's part of the process of the decision-making. I'm so happy I was a part of it. For the fans who miss Joanna, you can always go back and rewatch seasons one and two!

What were some of the questions you had for Sam when you found out Joanna was going to die?

You have to see it like death. Joanna becomes a person on her own when we're filming, and then I'm not Stephanie, I'm Joanna, and I'm in this universe — and in this universe, whether you subscribe to religion or not, Sam will always be God. He's the one who pulls the strings and he's the one who makes the decisions. Because I have the utmost respect for him, I trusted his decision. Of course I asked why, and all of these things. For him, the easiest way to describe it was it felt to them like the most natural development or evolution for Joanna, to end there. For the Mr. Robot universe, that's probably a good thing, because nobody knows what she could have come up with next!

In your mind, where was Joanna going before you found out she was going to die here? Did you have any pie-in-the-sky hopes for the direction of her story?

Oh, yeah. Absolutely. I hoped there would be more of her backstory. I hoped there was going to be a reunion between her and Tyrell. I love working with Martin. He's fantastic. I had hoped to see her really take over. You have your whole good versus evil between E Corp. and Elliot, even if the roles are hard to define. But I would have really wanted to see her come in as a wild card and somehow play both sides, and see her grow, because every move and decision she's made so far has made her increasingly more powerful. I would have wanted to go further with that. But it is what it is. I feel bad for the baby!

What was your reaction when you learned the extent of the violence involved in Joanna's demise — shot in the head, in front of her child, with her blood splashing on her own child's face?

It was so terrible. It was a very moving thing to experience. While you're filming, you're partly aware that you're being filmed and on camera, of course. But the emotional registry from Joanna's part, in that last moment, all she wants to do is protect the baby. She doesn't even really care about herself. [Joanna's bodyguard] Sutherland has been shot, and instead of being "Oh no, no, no," for him, it's about her baby: "If I die, my baby is all alone." She does everything in her power in that last moment to protect the baby. It's heartbreaking.

What are your memories of shooting the death scene? It must have been exhausting.

It was. It was exhausting and very emotional. I cried. I think even Sam got a little teary-eyed. There was a lot of hugging involved. But I also wanted to remain professional and stay in character, because I really think if Joanna needs to go out, I need to put some good work into that. She needs to have a dignified death. I owe it to her. It was tough and exhausting and very emotional.

The scene in which Joanna is on the autopsy table ... was that you, or ...?

Oh, that's me! (Laughs.) That's really me. And it's really hard playing dead. Really hard! I have newfound respect for actors when you see them on shows and you see them dead all the time. First of all, keeping your eyes open without blinking is near to impossible. Not breathing when there's a camera on you, shooting that long scene with Dom and Santiago? It was so hard not to breathe, to lay perfectly still, and that was me the whole way through. The prosthetics were made from our head of make-up, and they just looked so gory and so good. I have some really fun videos of me walking around like I'm on The Walking Dead.

Was it helpful with the grieving process, to play that final stage of Joanna — as a body on a table?

Thankfully, it was shot on separate days. In the end, it's part of the artistic process to become familiar with and develop a relationship with your character, but it's still just a job. That day, I was just running around and scaring people. (Laughs.) It was really super fun.

Do you regret that Joanna and Tyrell never reunited?

Yes. It would have been beautiful in their own twisted sense of romance. I'm very, very sad that that didn't happen. Obviously I respect Sam so much and his decision, but I wish I could have continued on the show. And I want to make it very clear to all of the fans: It's definitely not me who asked to leave. I would have loved to stay on forever and ever. And I'm still going to watch season three. I'm super excited for it.

In season two, the ghost of Tyrell was haunting the year and Joanna's story in particular, even though he was actually alive. Do you expect the ghost of Joanna to similarly linger in season three and haunt Tyrell, now that we know she's dead?

I really don't want to confirm or deny anything! But I would absolutely be up for that. I think that could be a super interesting twist. But I don't know what's scarier: Ghost Joanna, or real Joanna? I'm not sure we want to find out. (Laughs.) Imagine if you don't even have to answer the door and she can just walk through!

There are opportunities to return, though, since this show deals in flashbacks, hallucinations, potentially other universes ...

Oh, anything is possible. Everything is possible.

You're open to a return, then?

One hundred percent. I would absolutely love to return. This has been one of the greatest experiences of my life. I can't even begin to tell you how awesome everybody is on that set. It's everyone from catering to the director — the whole line. I would love to come back.

For now, as you put the character to rest, who was Joanna Wellick in your mind?

At the end of the day, Joanna Wellick is the person I would want to be if I could let go of all socially acceptable behavior and just do what I want. (Laughs.) It must be very freeing, living like that. Do whatever you want, whenever you want, with no consequences — and if there are consequence? You don't really give an F about them.

Follow THR.com/MrRobot all season long for interviews, analysis, podcasts and more.