Trailing 5-3 coming into their last at-bats, the Pirates scored the four runs to stun the Cubs and clinch their three game-series at Wrigley Field.
Former Cub Lee, down to the Pirates' last strike, then golfed a low pitch into the left field stands for the decisive slam.
Lee finished with five RBI and Chris Resop (5-4) earned the win in a game that featured a lengthy rain delay in the bottom of the seventh.
Joel Hanrahan tossed a 1-2-3 ninth for his 34th save.
Alfonso Soriano drove in four runs with a two-run double, a run-scoring single and sacrifice fly for Chicago.