Swansea were playing their final pre-season friendly before next Saturday's Premier League season opener at QPR.
The visitors dominated the opening half as Christian Gentner and Vedad Ibisevic found the net.
Swansea recovered thanks to a double from Graham, fresh from his midweek hat-trick against Blackpool, and Nathan Dyer's deflected cross put them ahead, only for substitute Raphael Holzhauser to earn Stuttgart a draw.
The Germans took a deserved lead on 18 minutes as Gentner acrobatically volleyed home from Ibrahima Traore's excellent free-kick.
Ibisevic, part of the Bosnia squad to face Wales next week, then doubled the lead when he was given far too much time in the box to fire left-footed beyond Michel Vorm.
The Welsh club, with reported Manchester City target Scott Sinclair in the starting line-up, hit back after the break as Michu teed up Graham to slot home after 53 minutes.
The goal sparked Swansea into life and they found a leveller with 20 minutes to play.
Dyer went down in the box under the challenge of Cristian Molinaro, his appeal was waved away by referee Huw Jones but the official pointed to the spot on the advice of his assistant, to the fury of the Stuttgart players.
Graham stepped up to convert from the spot and Swansea completed the turnaround by taking the lead three minutes later.
Dyer worked his way free down the right and his cross was helped into his own net by the unfortunate Molinaro.
The winger could have killed the game off but missed an open goal after rounding Sven Ulreich, and the error was punished as Holzhauser fired home seconds after coming on.