Cristiano Ronaldo and Jose Mourinho were sent off as Atletico Madrid beat Real Madrid in extra-time at the Bernabeu to overcome their local rivals for the first time in 14 years and lift the Copa del Rey.
Miranda's header in the 99th minute won it for Atletico. Ronaldo's header gave Madrid the lead after 14 minutes, but Diego Costa levelled 10 minutes before half-time.
Madrid struck the woodwork twice in the second half while Juanfran blocked a shot from Mesut Ozil on the line to force extra time.
Atletico goalkeeper Thibaut Courtois made two superb saves to keep his side in front.
Madrid's frustration told and, with Mourinho having been sent from the technical area during normal time, Ronaldo saw red in the 114th minute for kicking out at Atletico captain Gabi - who was himself dismissed in the frantic final minutes for a second bookable offence.
It is the 10th time that Atletico have won the Copa del Rey, and is the third trophy Diego Simeone has won in just 18 months in charge of Los Rojiblancos. That matches Mourinho's tally during a three-year stint at Madrid now expected to come to an end in the summer.
Simeone put out his usual starting 11, while Mourinho chose Raul Albiol ahead of Pepe, who he has not picked since the defender criticised him in public.
As fate would have it, it was an error from Albiol which lead to Atletico's equaliser, while Diego Lopez, who Mourinho has preferred to Iker Casillas since January, was at fault for the winner.
The game had a cagey start but Madrid took the lead after 14 minutes when Ronaldo leapt above a helpless Diego Godin to head the ball into the net from an Ozil corner.
Atletico struggled to penetrate a physical Madrid, who limited their opponents' opportunities to a long-range effort from Gabi that went over the bar and set pieces.
When Simeone's side finally did create a clear opportunity, they equalised.
Falcao dispossessed Albiol on the halfway line, then showed great strength to hold the ball up before releasing Diego Costa, who raced towards goal and shot past Lopez, who got a hand to the effort but could not prevent it from going into his net off the post.
Madrid nearly restored their lead just before half-time when Ozil cracked a shot from outside the area off the inside of the post.
Early in the second half, Courtois had to be alert to stop a free-kick from Ozil creeping into the net, and got a fingertip to it to send it out for a corner.
At the other end, Filipe Luis had two chances to score, a scuffed effort and then a powerful volley that went just a few feet wide of the near post.
A minute later, Madrid had two golden chances to score but somehow did not take advantage of them.
Ronaldo got down to the byline to pull the ball back to Benzema in the six-yard box, but the France striker's deflected shot hit the post and fell back out to Ozil, whose shot was blocked on the line by Juanfran.
Simeone celebrated his team getting out of jail as if they had scored.
Not long after, Ronaldo hit a low free-kick off the post, the third time Real had hammered the frame of the goal.
Midway through the second period Atleti won a succession of fouls in the middle of the pitch, to the frustration of Mourinho, who was sent down the tunnel for his protests, bringing an ugly end to what is likely to be his last final in charge of Los Blancos.
Five minutes into the extra-time, Diego Costa got behind the Madrid defence but could only shoot straight at Lopez.
Moments later, Atleti took the lead when Miranda got up to head in a cross from Koke and send their 30,000 fans into delirium.
Madrid substitute Gonzalo Higuain could have equalised right before the break, but was denied by an excellent stop by Courtois.
The Belgian then made an even better save in the second half of extra-time, leaping across his goal to tip away a point blank shot from Ozil.
Ronaldo added to Madrid's problems when he was sent off for lashing out at Gabi, although the midfielder appeared to exaggerate the impact of the challenge.
Lopez came up for a Madrid corner in the final minute of the match, but Atleti stood firm to record their first victory over their rivals in the 21st century, ending their barren run in the sweetest of manners.