De La Rosa (4-5) appeared to be in control outside of a solo homer by Sean Rodriguez in the fourth as the Arizona offense gave him a 4-1 lead.
"I think he was pitching in really effectively," D-backs manager Chip Hale said. "He pitched in hard, which allowed his slider to be really effective -- you saw a lot of swings and misses on the slider."
The Pirates got back-to-back singles to lead off the fifth and Gregory Polanco doubled home a run to make it a 4-2 game.
A Starling Marte groundout brought home another run and brought David Freese up to the plate.
De La Rosa hung a 2-2 slider to Freese and he belted it over the wall in center to put the Pirates up, 5-4.
"He just tired out," Hale said of De La Rosa. "It's his game in that fifth inning. Anything but a home run there and it would be a tie game and we'd get him out. But he hung a slider and Freese has made us pay numerous times this year; he's really been a thorn in our side."
It was De La Rosa's first start since May 15. With two off-days in a five-day span, the D-backs elected to skip a starter, and with De La Rosa nursing some nagging aches, they decided it would be him.
"I felt good today," De La Rosa said. "In the game, I made a lot of mistakes and paid the price. It cost me the game. I've got to make better pitches. I left the slider right in the middle and [Freese] got a good swing on it and hit a homer. Next time, I'll make a better pitch."
Catcher Welington Castillo initially called for a sinker on the pitch that Freese hit out, but De La Rosa stared at Castillo, who changed the call to slider.
"I gave him the vote of confidence there that he would make a good slider and he just hung that one," Castillo said. "He wasn't taking a good swing on the sinker down and in. But you never know. When stuff is going to happen, it's going to happen. He might have not located his sinker and he would have hit a homer too off the sinker."