The Rays won their fourth in a row, the last three having come against the Marlins. With two games remaining in the month of May, Miami lost for the 40th time this season.
Hernandez (3-5) bounced back from two struggling starts in which he gave up a total of 10 runs in six innings. He did not walk a batter and struck out five.
Hernandez retired 15 batters in a row prior to Polanco's hit, after which Fernando Rodney came on to record the final out and pick up his 10th save. Hernandez has seven complete games in his nine-year career, but none since 2010.
A sacrifice fly by Yunel Escobar delivered the final Tampa Bay run in the seventh.
Tom Koehler (0-3) took the loss, turning in an eight-inning stint while giving up three runs on seven hits.