Patrick Bamford???s goal in the early stages of the second half put Boro ahead and substitute Kike doubled the lead in stoppage time to take the Championship side into the last 16.
Although there were opportunities for Willy Caballero and Dedryck Boyata, City boss Manuel Pellegrini named a strong side that included the likes of Vincent Kompany, David Silva and Sergio Aguero so could hardly point to a weakened line-up.
But in a game that pitted a former Real Madrid coach in Pellegrini against a former assistant manager at the Bernabeu in Boro boss Aitor Karanka, it was an ex-Real goalkeeper that stole the show.
Tomas Mejias made just one La Liga appearance for the Spanish giants prior to joining Middlesbrough last year but showed plenty of class in a hugely impressive display to deny City.
Mejias kept out Stevan Jovetic???s rasping shot from distance before pulling off an even better save to deny James Milner from the edge of the penalty box as City pushed hard in the first half.
Although he had help from Boyata who spooned a close-range effort way over the bar, the save from Silva???s deflected effort was the pick of the lot as Mejias dived to his right to deny his compatriot.
In front of him, Boro defended with resilience to restrict City to a series of shots from the edge of the area before the break ??? closing their illustrious opponents down when they ventured inside the 18-yard box.
Adam Clayton produced a perfectly-timed tackle to dispossess Jovetic when well-placed, while Ben Gibson hurled himself in front of Silva when the playmaker looked set to open the scoring.
At the other end, Karanka???s men offered enough of a threat in the opening 45 minutes to encourage their away support with Lee Tomlin even seeing a header disallowed due to an offside in the build-up.
But Boro, with their composed passing and considerable commitment, were not to be denied and they capitalised on some woeful City defending to take the lead soon after the interval.
Albert Adomah latched onto an underhit Fernando backpass, blocking Caballero???s wild clearance, and with the ball trickling towards the net, Bamford was there to force the ball home.
Although Aguero had a strong penalty shout at the other end, Boro continued to cause problems and had the chance to double the lead soon after only for Grant Leadbitter to see his shot blocked.
Tomlin then produced an amazing piece of skill to drag the ball away from his marker only for his stabbed effort to hit the post and roll agonisingly across the face of the goal.
Pellegrini responded with a double substitution, turning to Fernandinho and Frank Lampard in an attempt to salvage something, but this time the woodwork came to Boro???s rescue instead.
With one minute remaining, a trademark Lampard effort from distance took a deflection that took the ball beyond the reach of Mejias but the ball rebounded off the inside of the post and to safety.
With four minutes of stoppage time, the away fans might have been jittery but the players appeared calm and seized the chance to punish City on the break in the closing moments.
Four Boro players were in the attack and when the ball was helped out to the left channel towards Kike, the forward stroked the ball beyond Caballero to seal a stunning victory.