Losing pitcher Jose Capellan (0-2) struck out two batters in the top of the 10th inning with the potential go-ahead run at third base, but walked two and gave up a hit in the 11th to stage the Royals' winning rally. Capellan was replaced by Chris Spurling, who walked in the go-ahead run.
David Riske (1-2) took the win, working around Kevin Mench's one-out double in the bottom of the 10th inning. Jimmy Gobble pitched the bottom of the 11th for his first save this season and third of his career.
The National League Central-leading Brewers missed a chance for their second consecutive three-game sweep, but have still won nine of their last 11 games. Before Sunday, they were 37-3 when leading after seven innings and the Royals were 2-36 when trailing after seven frames.
Hart's homer off veteran right-hander Octavio Dotel let Brewers reliever Derrick Turnbow off the hook for a tough eighth inning that began with a four-pitch walk. Turnbow surrendered two runs in the inning on two hits, including Mark Teahen's go-ahead single that gave the Royals a 3-2 lead.
Milwaukee starter Yovani Gallardo, who pitched 6 1/3 innings to beat the Giants last week in his Major League debut, this time worked seven strong innings, allowing a run on five hits with eight strikeouts. He was in line to be the first Brewer since Tom Candiotti in 1983 to win his first two career starts before Turnbow lost the lead.