Luke Williams's stunning late strike gave Middlesbrough their first points of the new Championship season.
Charlie Austin had given Burnley the lead when he headed in unmarked at the back post, but just a minute later Nicky Bailey drove the hosts level.
Adam Reach's curling effort put the home side back in front only for Junior Stanislas to scramble in a leveller.
But Williams snatched the victory for Boro on 88 minutes when he smashed a long-range effort into the top corner.
Williams's fine effort capped a thrilling final 10 minutes which saw three goals, two for the home side of the highest quality and the bundled effort for the visitors.
Boro, who lost their first league game of the season to Barnsley, fell behind when Dean Marney fed Kieran Trippier who crossed cleanly from the right for Austin to steal in and head home.
The celebrations of the away fans were muted one minute later, when Bailey drilled in from 20 yards out.
The impressive on-loan Chelsea midfielder Josh McEachran dominated proceedings in the second half and went close with a header from Reach's diagonal cross.
Defender Reach then picked up a loose ball to scoop a wonderful drive across Grant and into the back of the net just two minutes later.
Stanislas edged a goalmouth scramble to scuff a header beyond Jason Steele and seemingly stifle the celebrations.
But it was Williams, a tactical substitute for the tiring Curtis Main, who had the final word with an unstoppable drive into Lee Grant's top corner.
Middlesbrough manager Tony Mowbray told BBC Tees:
"It was a great night to be a Boro fan.
"Obviously we were all disappointed at the weekend and if we hadn't got a result here I'd have been talking about the team needing to grow into itself, but we had a lot of young players who stepped up to the mark.
"We have some players who are more comfortable on the ball this season.
"I still think we'll have some ups and downs, it's still quite a young group, but they showed they have what it takes to compete in this division."
Burnley manager Eddie Howe told BBC Radio Lancashire:
"They're goals that you won't see every week, especially in the same game. They were two great strikes.
"I can't be too critical of my team. I thought we battled back brilliantly from 2-1 down.
"Although we've lost the game, we fought right to the end and we can take credit from that."
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.