Homers by Alvarez and Hart in the seventh inning provided three insurance runs that ended up being the difference after closer Mark Melancon gave up three runs in the ninth inning.
Cole (1-0) had eight strikeouts in his second start of the season and cruised through the high-powered Tigers offense until he was pulled with the bases loaded and no outs in the seventh. The former No. 1 overall draft pick yielded one run on three hits and two walks.
"That's a lineup that's playing as big as any lineup in the majors this year and from top to bottom, he had command," said Pirates manager Clint Hurdle.
The Tigers suffered their first loss of the season after starting 6-0 for the first time in 30 years.
Anibal Sanchez (1-1) struck out nine and walked none but gave up five runs on eight hits in 6 1/3 innings.
Yoenis Cespedes followed with a single to put the tying run on base, but Melancon got Nick Castellanos to ground into a double play and then struck out Victor Martinez to end the game.
Harrison homered on Sanchez's first-pitch fastball to lead off the first inning. He started the third with a single, move up on Gregory Polanco's double and scored on Andrew McCutchen's long fly out to make it 2-0.
Cole faced just two batters over the minimum in the first six innings, giving up a walk and a single. He was pulled after putting the first three batters on base in the seventh.
Jared Hughes got Castellanos to ground into a double play on his first pitch out of the bullpen, scoring Detroit's first run, and then retired Alex Avila on a pop-up to end the inning.
Alvarez and Hart homered off Sanchez in the bottom of the seventh. Hart's pinch-hit blast was his first as a Pirate.
The Pirates reinstated pitcher Francisco Liriano from the paternity list and optioned pitcher Casey Sadler to Triple-A Indianapolis ... The Tigers were trying to start 7-0 for the first time since 1984, the year they won their most recent World Series title ... The teams split a four-game home-and-home series last season with each team winning both games in its own stadium.