Zinedine Zidane's side were humiliated at home as they suffered a 4-3 defeat to Real Sociedad - where Odegaard is on a two-year loan.
It was a thrilling game in Spain, as Real came back from 4-1 down to pull it back to 4-3, but Sociedad – featuring former Arsenal defender Nacho Monreal and ex-Man United ace Adnan Januzaj – managed to hold on to progress to the semi-finals.
Odegaard, who signed for Los Blancos in 2015 at the age of 17, opened the scoring against his club after 22 minutes.
Swedish striker Alexander Isak, 20, then scored twice in the space of two minutes early in the second-half to leave the Bernabeu stunned.
Two quick goals from Alexander Isak early in the second half did the damage and, although Marcelo pulled a goal back, Mikel Merino swept in a fourth.
Vinicius saw a header ruled out by VAR, before substitute Rodrygo reduced the deficit and Nacho set up a dramatic final few minutes of added time.
Marcelo pulled a goal back for the hosts, before Mikel Merino restored the visitors’ advantage. Vinicius then saw a header ruled out by VAR, before substitute Rodrygo reduced the deficit to 4-2.
Nacho the scored a third to set up a dramatic final few minutes of added time, but although defender Ander Gorosabel was sent off for a second caution, Sociedad closed out a famous victory.
It ended Real Madrid's run of 21 games unbeaten in all competition.
And while angry at their side's performance, there was a moment of class from Real supporters as they gave Norwegian starlet Odegaard a standing ovation when he was substituted in the second-half.
It was also the second surprise result of the night, as Barcelona were also knocked out of the cup as they were beaten 1-0 at Athletic Bilbao.
Still no Bale
Zidane made seven changes from the side that beat rivals Atletico Madrid in their last LaLiga game, but there was still no place in the squad for Gareth Bale, who remains out of favour in Spain.
But the manager made no apologies for his squad selection.
“Others have played and fought," said the Frenchman.
"It is what had to be done with those who were able to play."
Martin Odegaard received a standing ovation from Real Madrid fans after scoring his first senior goal at the Bernabeu, even though it was AGAINST his parent club and it helped to knock them out of the Copa del Rey!