Substitute Lloyd Dyer's last-gasp goal gave Leicester victory and ended Middlesbrough's 100% home record.
Nicky Bailey put Boro ahead with a stunning 30-yard drive and Lukas Jutkiewicz almost made it 2-0 soon after when he fired against the bar.
But Leicester hit back when Jamie Vardy turned in David Nugent's deflected shot and created a flurry of late chances.
Anthony Knockaert fed Dyer, whose shot took a huge deflection and looped over Boro keeper Jason Steele.
Knockaert should have sealed victory late on when he was sent clear one-on-one with Steele, taking the ball round him only for Seb Hines to hack the ball clear.
It was the Foxes' fourth victory in five matches but the first points they have taken on their travels after three defeats.
A bad day for Boro was made worse by an injury to Jonathan Woodgate, who was forced off in the 37th-minute with what appeared to be a recurrence of a niggling hamstring problem.
Woodgate's absence was immediately noticeable from a Leicester set-piece as Nugent rose highest to head over the crossbar.
And Tony Mowbray's men continued to struggle at the back, relying on a succession of fine stops from Steele to stay in the game as long as they did.
Middlesbrough manager Tony Mowbray: "It was a close game but they all are in this division.
"We have won tight games at home like that. We haven't beaten teams four or five.
"They are a good side and it was always going to be tight so once we got our noses in front we hoped we could hold on. We know that in games like that you need the second goal."
Leicester manager Nigel Pearson: "I think maybe we got lucky, but given the way things have gone against us so far this season maybe we deserved to get a bit of a lucky break.
"Tony [Mowbray] has pointed out that he thought the first one was offside and maybe he has a case and for the second one, yes, maybe there was some question marks over the free-kick for the second.
"But as I say, we have deserved to get the rub of the green, and to be fair, we did create a lot of chances. We did help make our own luck."