The Pirates pushed across a run in the eighth inning on an Andrew McCutchen RBI single to forge a 1-1 tie and then battled through five scoreless innings before finally breaking the deadlock.
Sanchez began the bottom of the 14th with a single against Francisco Rodriguez (1-1) and, after Michael McKenry flied out, swiped second -- his first stolen base of the year.
Jordy Mercer coaxed a walk and Martin, hitting for pitcher Tony Watson, grounded a hit up the middle and Sanchez easily scored as the National League Central-leading Pirates improved to an MLB-best 51-30.
Watson (2-1), the last of seven Pittsburgh pitchers, tossed three innings of shutout relief to gain the win in a contest delayed 2 1/2 hours in the second inning by rain.
Logan Schafer drove in Milwaukee's only run.