Marco Asensio's late goal had earned Madrid a 1-0 advantage in last week's opening leg of the quarter-final, putting Zidane's side in full control of the tie heading back to the Santiago Bernabeu.
But despite Zidane recalling Sergio Ramos and Karim Benzema - although Cristiano Ronaldo and Gareth Bale were rested - Leganes sealed a 2-1 victory and progressed on away goals.
Javier Eraso's 25-yard screamer pulled the visitors level on aggregate and, after Benzema's goal early in the second half, Eraso's corner was thumped home by a tremendous Gabriel Pires header.
Leganes are the first team in Copa history to knock out Madrid at the Bernabeu after losing at home in the first leg and with the champions 19 points behind La Liga leaders Barcelona, their chances of adding any domestic silverware to their Supercopa de Espana title look to be over.
And Zidane, who has led Madrid to successive Champions League titles, believes a meeting with PSG in the last 16 next month could decide his immediate future.
"Of course. That is really clear," Zidane said when asked if his job was on the line. "I am responsible for this, I'm the coach.
"So I must find solutions. I must take on the situation. I will keep always fighting, keep working, try and look for things to make the team better. Nothing more.
"I don't regret leaving out players. Some players needed to rest. On paper this was a competitive team, then in the first half no, we did not compete."
1 - Leganes are the first team in Copa del Rey history to knock out Real Madrid at Santiago Bernabeu after losing at home in the first leg. Correction. pic.twitter.com/tO51r3r4HK— OptaJose (@OptaJose) January 24, 2018
Madrid failed to record a single shot on target in the first half, although Ramos and Benzema forced fine late saves from goalkeeper Nereo Champagne, and Zidane accepted the performance was not good enough to keep his side in the competition.
"In the end the result is logical, as the opponent played their game and we did not," Zidane said. "I am responsible for this, it is a failure for me today.
"Winning 1-0 there and taking on the return game as we began it today, I am angry at that and do not understand it. But now we must see how we will turn this around.
"I am very disappointed and will take responsibility for all this. But I will keep working, tomorrow is another day, and what we must do is pick ourselves up and think of Saturday's game [at Valencia]. But today is a very hard blow.
"I am responsible for this. I pick the team - and in the end I was wrong about many things. I am angry with myself, not with my players. My players tried, ran, maybe they played badly, they have part of the blame, but I am the most responsible.
"The solution is to keep working. I will take on this situation and I will keep working as I have always done. You can ask what happens now? We will continue, we must change this, there are many games left to do it. Today is a failure for me.
"We must give more, me first, as all that we have given so far is not enough, we must give more, train harder, help each other more, and we will try and do that."
Queried about whether 2017-18 could go down as the worst season in Madrid's history, Zidane added: "I always think positively, even after this failure, even tonight when we must apologise to the fans. We have a game on Saturday, and on February 14 we have a Champions League game."