Barmby kept his composure to convert a fine cross from Robbie Brady in the 71st minute and send the Tigers into the top six. It was the Cardiff's first away defeat since March.
Bluebirds teenager Joe Ralls had earlier marked his league debut - 48 hours after signing his first professional contract - with a superb 20-yard shot, which had cancelled out Matty Fryatt's opener shortly before half-time.
Hull had already lost twice at the KC Stadium this season, but rarely looked like slipping to another against in-form Cardiff, who were unbeaten in seven league games prior to kick-off.
Austrian winger Martin Pusic made his league debut for Hull in place of Tom Cairney, while Cardiff were unchanged from the side that started in midweek.
Cardiff began full of confidence after Wednesday night's win over leaders Southampton, but could have found themselves two goals down in the first 16 minutes.
Hull's teenage winger Brady, on loan from Manchester United, forced Cardiff goalkeeper David Marshall into a flying save with a thumping 25-yard free-kick and within 60 seconds midfielder Corry Evans volleyed just over the crossbar.
Cardiff had been dealt an early blow when striker Kenny Miller was forced off through injury and replaced by Ralls, while the visitors had to wait until the 30th minute before their first effort on goal when former Hull loanee Anthony Gerrard headed wide from Peter Whittingham's corner.
Hull looked the more likely side to break the deadlock though and after Martyn Waghorn had headed Liam Rosenior's cross just wide, Fryatt opened the scoring six minutes before the interval.
Pusic played the ball into the penalty area from the left and Fryatt wriggled clear of his marker to squeeze a low shot between Marshall and the inside post for his second goal of the season.
Hull midfielder Robert Koren flashed a 25-yard volley wide after the break and Fryatt saw his shot from inside the area well saved by Marshall.
But slightly against the run of play Cardiff equalised in the 62nd minute with a goal that will live forever in the memory of Ralls.
Bluebirds midfielder Kevin McNaughton found Ralls with a pass from his own half and the youngster carried the ball into space towards the edge of the area before unleashing an unstoppable shot into Hull goalkeeper Adriano Basso's top right-hand corner.
Brady and Whittingham traded 20-yard efforts as both sides went in search of a second goal and Cardiff striker Joe Mason fired straight at Basso.
But Hull regained the lead in the 71st minute. Brady whipped over a fine cross from the right into the danger area six yards from goal and Barmby despatched a left-footed finish into the bottom corner.
Waghorn hobbled out of the action with 10 minutes left and was replaced by Aaron Mclean and despite Basso's late injury - he was replaced by Peter Gulacsi in the 94th minute - Hull comfortably held on to their lead.
Source: Team Talk
Source: Team Talk