The shock victory was tainted after the visiting manager refused to shake hands with Portland Timbers coach Caleb Porter following a series of tough challenges on his players
Bradley Wright-Phillips and Landon Donovan scored the goals for the All-Stars in Portland, as they won the MLS All-Star Game for just the second time in the past six years.
But the exhibition match ended in far from friendly fashion with Guardiola refusing to shake All-Stars coach Caleb Porter's hand after the game, due to a pair of crunching tackles on his players in the second half.
Osvaldo Alonso clattered into Xherdan Shaqiri in the 64th minute, prompting Guardiola to unleash a diatribe at Porter, who looked apologetic.
By the time Will Johnson slid into Bastian Schweinsteiger in the 89th minute, Guardiola could barely contain himself, while Porter looked sick, sitting on the bench.
Porter barely celebrated after the game, although he did attempt to shake Guardiola's hand but with the Spanish coach refused, wagging his finger at the All-Stars tactician, before angrily confronting the referee.
Bayern started well with Robert Lewandowski proving an early threat before scoring his third goal of pre-season since joining the Bavarian club from Borussia Dortmund.
Just after flicking the ball over a defender only to fire straight at goalkeeper Nick Rimando, Lewandowski opened the scoring in the eighth minute, again finding space before unleashing a blistering half-volley from the edge of the box that dipped under the crossbar.
While Bayern unsurprisingly dominated possession in the first half, the All-Stars had some opportunities to score with Clint Dempsey forcing Tom Starke into a sharp save, before Thierry Henry looped a volley onto the roof of the net.
But eight minutes before the break, the German visitors gave Porter something to worry about with Shaqiri playing a one-two with Lewandowski before forcing Rimando into a brilliant stop.
The All-Stars equalised just five minutes after half-time when MLS leading scorer Wright-Phillips continued his brilliant form, getting onto Erick Torres' flick-on before crunching a left-footed shot into the top corner of the net.
The goal was Wright-Phillips' ninth in the past 10 games with the 29-year-old Englishman having scored 18 in MLS this season.
Donovan then struck the winner in the 70th minute, getting goal-side of Rafinha to collect Diego Valeri's cross and score.