England Under-21 international Bamford pounced on a defensive misunderstanding early in the second half and substitute Kike settled a thrilling fourth-round tie in injury time at the Etihad Stadium.
City dominated the first half but were denied repeatedly by Boro's former Real Madrid goalkeeper Tomas Mejias and their luck seemed out when Frank Lampard's deflected 89th-minute shot hit the post.
Had that gone in they might have snatched a replay but Kike stunned them in the closing moments.
Boro deserved their success for their resilience in defence and incisiveness up front, with the excellent Lee Tomlin also hitting the woodwork.
But the result will also raise further questions of the wisdom of City's decision to travel to Abu Dhabi for a five-day warm-weather training camp in the build-up to the game.
After last week's loss to Arsenal, Manuel Pellegrini's men have hit an untimely slump and next week's trip to title rivals Chelsea takes on critical importance.
City boss Manuel Pellegrini had fielded a strong side and they looked bright early on, showing no signs of weariness after their travels.
Boro also started well and Tomlin headed the ball into the net early on but the flag had long been raised for offisde.
It took some time for City create any meaningful chances but a couple of dangerous runs from Sergio Aguero suggested they were keen to take a grip of the game.
They moved up a gear as David Silva had a shot blocked and Aguero latched onto a good ball from James Milner and beat two defenders before slamming a shot into the side-netting.
Milner then shook off the attention of Adam Clayton to deliver a menacing cross from the right and Aleksandar Kolarov and Stevan Jovetic both tested Mejias in quick succession.
Silva and Milner also shot at Mejias before combining at a corner to create a glorious chance for Dedryck Boyata but the defender miscued his first attempt and blasted his second over.
Milner then brought a superb full-length save out of Mejias with a low drive and Silva also extended his fellow Spaniard when his long-range effort took a deflection and almost crept inside the post.
The keeper then produced an even better save to beat away a piledriver from Jovetic after Silva had narrowly failed to get a connection to a Jesus Navas cross.
The bombardment looked set to continue in the second half as Kolarov had a free-kick deflected narrowly wide and Mejias was again called into action to keep out a Jovetic header.
But Boro took great confidence from their defensive strength and began to play more expanisvely.
They started to push forward and Vincent Kompany was booked for a rash foul on Jelle Vossen.
That indicated to Boro that they could ruffle their hosts and so it again proved as they took the lead after 53 minutes following some shambolic defending by City.
Fernando sold Willy Caballero short with an under-hit backpass and Albert Adomah seized the opportunity, knocking the keeper over in a fair challenge to win the ball and slipping it towards goal
Bamford ran in to finish off.
Aguero went down in the area under a challenge from Clayton but nothing was given by referee Phil Dowd and Middlesbrough maintained the pressure and threatened a second.
Adomah went through but failed to beat Caballero before Lee Tomlin produced a wonderful turn on the edge of the box only to shoot agonisingly against the post.
City tried to disrupt Middlesbrough's ryhthm by sending on Frank Lampard and Fernandinho but they got little joy as they approached the visitors' well-guarded goal.
Clayton cut out a hopeful ball from Kolarov and George Friend blocked Aguero.
Boro countered and Caballero did well to push away a fine volleyed effort from Vossen as he latched onto Adomah's deep cross.
City kept pushing and almost scored when Lampard's late effort took a deflection and looped onto the post.
Boro made the most of the reprieve and Kike sparked jubilant celebrations as he raced through from a Bamford pass and calmly beat Caballero.
Source : PA