The Copa del Rey trophy was supposed to be coach Jose Mourinho's parting gift for Real Madrid, or at least a consolation prize after a season that will be remembered for his abrasive antics and his team's failure to win silverware.
Instead, Atletico Madrid ended a 14-year winless run against its city rival by taking the title on Friday, coming from behind for a cathartic 2-1 win in extra time after Mourinho and his star forward Cristiano Ronaldo were sent off.
Brazilian defender Miranda headed in Jorge "Koke" Resurrecion's cross in the eighth minute of extra time to give Atletico its 10th Copa del Rey title and first since 1996.
"This is for our fans that have suffered for 14 years," Atletico's captain Gabi Fernandez said moments before he received the trophy from Spain's King Juan Carlos. "This team worked hard for this and deserved it."
Ronaldo appeared to have put Madrid on its way to yet another victory over its crosstown rivals when he headed in a goal in the 14th minute. But Atletico refused to fold and Radamel Falcao set up Diego Costa to level 10 minutes before halftime.
Mourinho was sent off for protesting a decision in the 76th. Likely heading back to England in the off-season, he will finish his last campaign in Madrid without a title after it lost the Spanish league to Barcelona and bowed out of the Champions League semifinals.
"This is my worst season. I have never not won an important title. You can say I failed this season," Mourinho said. "With one final, a semifinal, a second-place finish, and a Spanish Supercup, for many other coaches it would have been a good season. For me it's the worst."
Mourinho repeated that he would decide his future with club president Florentino Perez after the season ends in early June, although there is strong expectation he will return to former club Chelsea.
Red card for Ronaldo
The final was a vibrant match but not without its ugly side.
Ronaldo received a straight red card for kicking Gabi in the face in the 114th, setting off a sideline scuffle between the benches.
Atletico goalkeeper Thibaut Courtois was struck in the head by an object thrown from the Santiago Bernabeu stands shortly afterward.
Atletico also ended the match with 10 men when Gabi was sent off seconds before the final whistle for a second yellow card. But that came too late to prevent a victory that even the coach acknowledged was a lucky one, with Madrid's shots repeatedly hitting the frame of the goal.
"We had the good fortune that a champion needs," said Atletico coach Diego Simeone, who added the cup to the Europa League title won last year. "What these players have done for the past year and a half is amazing. I don't have words for it."
Following years of frustration and accumulated doubt after failing to beat Madrid in 25 games since 1999, Atletico had to overcome an opening goal by Ronaldo.
Ronaldo, who scored the extra-time winner that beat Barcelona and gave Madrid the 2011 Copa title, looked set to play the starring role once again when he rose over a defender to head in Luka Modric's corner and net his 55th goal of the season.
But the Portugal forward let the emotion of the game's final minutes get the best of him, hurting his side when he left it a man down just when it most needed his help.
Mourinho spent the game in the dugout after being jeered before the match by both sets of fans, with the home supporters upset at his dropping of iconic goalkeeper Iker Casillas and supposed desire to return to England.
When he did emerge, he didn't last long as the referee dismissed him for vehemently protesting a foul.
Atletico didn't panic
Atletico held firm after Ronaldo's opener and were rewarded with an equalizer. Falcao held off Raul Albiol's tackle, spun with the ball, and placed a perfectly weighted pass for Diego Costa to run clear and drive a left-footed strike under 'keeper Diego Lopez.
"Incredible," Falcao said, on the point of tears. "We are so happy for this win. We have to enjoy this."
Madrid came alive after Atletico equalized, and Mesut Ozil volleyed a long strike off the right post a minute from halftime.
The tension increased in the second half both in the stands and on the pitch, as Madrid began to tilt the action toward Atletico's area and soon had two golden chances in the 61st when Karim Benzema fired a loose ball off the upright. Ozil then pounced on the rebound and with Courtois off line seemed sure to score, but defender Juanfran Torres blocked his shot on the goalline.
In the 68th it was Ronaldo's turn to curse the goal frame when he fooled the defensive wall by slotting his free kick at the edge of the box under Mario Suarez as he jumped, only to see it crash off the post.
"It isn't normal to hit the post three times," said Mourinho. "You don't have to be an expert to think that the result wasn't fair, that Atletico isn't the just winner. But in football all that is forgotten, the posts, the referee, and Atletico goes down the winner."
With Mourinho gone, Madrid assistant Aitor Karanka made all three changes at the start of extra time. But even though Madrid had the fresher legs, it was Atletico that surged back in front for good.
Lopez saved Diego Costa's back-to-back tries in the 95th, but he couldn't stop Miranda from meeting an out-swinging cross to score at the near post by nodding the ball under the goalkeeper and into the net to send the fans clad in red and white into ecstasy.
Madrid wasn't done and only Courtois' goalkeeping protected its lead with stops to deny Gonzalo Higuain in the 104th and then Ozil in four minutes into the second added period when he stretched to deflect his close-range shot over the bar.