Cordoba dump Racing out of King's Cup
Cordoba, who had won the first leg 2-0 at home last month, were heading out losing 3-0 when a hotly-disputed handball in the area allowed their striker Jorge Luque to score from the spot in the 120th minute.
"The team played very well and we deserved much more," Racing coach Miguel Angel Portugal, who has been under pressure for a poor start to the season, told reporters.
"I think the referee made a mistake, nothing more, but sometimes they can have serious consequences."
Racing were on course to turn the tie around when Ivan Bolado squirmed through a cluster of defenders to poke the ball home in a muddy area after 25 minutes.
Under a steady rain, the hosts struggled to find the equaliser until 18 minutes from normal time when a freekick from Swedish midfielder Kennedy Bakircioglu evaded his onrushing forwards to drift inside the far post unaided.
Racing had dominated the game but as the tie moved into extra time Cordoba hit the crossbar with a looping freekick and headed the rebound against the woodwork.
A carbon copy of Racing's second goal put them on the verge of qualification when Edu Bedia's free-kick in the 102nd minute flew past everyone and inside the far post, but the visitors never gave up.
Luque's penalty had Cordoba coach Lucas Alvarez, who had just had surgery on his foot, hopping on the touchline on one leg waving his crutches in the air.
In the day's other game, Espanyol progressed 3-1 on aggregate after a 1-1 home draw against second division Real Valladolid, who played most of the second half with 10 men.
The rest of the second legs take place over the next two days.
The last 16 first-legs are scheduled to be played on December 22.