Jackson (2-8) tamed the Pirates on one run, yielding four hits and just a single walk. The right-hander notched only his second win in 12 starts for Chicago.
With the score tied 1-1 in the seventh, the Cubs put two runners aboard with one out and Ransom belted a 2-1 pitch from Justin Wilson (5-1) into the left-field bleachers for the decisive blow.
Scott Hairston also drove in a run for Chicago, which avoided a three-game sweep.
Pirates starter Jeff Locke, who took a no-hitter into the sixth inning, ended up allowing just one run on one hit over 5 2/3 innings, despite surrendering seven walks.
Garrett Jones provided the Bucs' only RBI.