Struggling in poor conditions at the small Principe Felipe stadium in the western Spanish region of Extremadura, Diego Simeone's Atletico were stunned on the half-hour mark on Thursday when forward Alvaro Merencio gave the hosts the lead following a quick counter-attack.
Cacereno goalkeeper Diego Nieves made a string of saves to keep the 7,000 local fans' dream alive, but the Spanish giants equalised in the 83rd minute when Rodrigo De Paul played in a perfect cross which Clement Lenglet headed into the back of the net.
Cacereno were reduced to 10 men after midfielder Jaime Sancho was shown a second yellow card for a tactical foul and Atletico substitute Julian Alvarez scored from a free kick, but the referee ruled the effort out.
Simeone was then shown a straight red for his complaints about the decision but his team went ahead two minutes into added time when De Paul fired home a deflected strike and Alvarez added a third following a counter-attack.
In some of the other results on Thursday, Osasuna fought back to beat lowly Ceuta 3-2 while Getafe beat Orihuela 3-0 on penalties after the match went goalless.
Sevilla beat Olot 3-1 while Dep Minera beat Alaves 4-2 on penalties after the tie ended 2-2.
Earlier in the week, Girona were knocked out on penalties by fourth-division Logrones and Villarreal were stunned by fourth-division Pontevedra 1-0 thanks to a last-gasp goal by Dalisson de Almeida. Espanyol were eliminated on Tuesday after losing 2-0 to lowly Barbastro.
Valladolid needed extra-time to beat Real Avila 4-2 while Leganes knocked out fourth division Estepona 3-2 on penalties after a 2-2 draw.
Valencia, Real Betis, Celta Vigo, Las Palmas and Rayo Vallecano progressed with comfortable wins.
Real Madrid and Barcelona enter the competition in the next round.