Atletico, who are third in La Liga and are looking forward to a Champions League clash next month against Liverpool, were one of four top-flight sides dumped out of the tournament on Thursday at the last 32 stage.
Argentine striker Angel Correa put them in front in the 62 minutes before Leonesa levelled seven minutes from the end through Julen Castaeda.
Sergio Benito then delievered the winner for the hosts in the second period of extra-time.
Defeat completes a miserable January for Diego Simeone's Atletico who were defeated in the Spanish Super Cup by Real Madrid and 2-0 at Eibar in La Liga last weekend.
Also exiting the Copa del Rey on Thursday were Eibar, Real Betis and Celta Vigo.