It unraveled slowly in the fourth inning — a two-out infield hit, a grounder that Chase Headley couldn’t field cleanly, a missed tag at home plate. In the seventh, Chasen Shreve left the field to a din of boos, with the Yankees’ winning streak all but snapped and a fresh reminder in its place.

The Blue Jays are probably not as bad as the standings indicate, and the Yankees still have a ways to go if they’re going to be as good as this recent stretch indicated.

The last-place Blue Jays (23-25) scored all but one of their runs and produced seven of their 11 hits with two outs. They took the lead in a gaffe-filled fourth and scored four runs with two outs in the seventh en route to an 8-4 win Wednesday night at the Stadium. The Yankees, who were riding a six-game winning streak, fell a game under .500 (22-23) after the top six hitters in their lineup went 0-for-23.

Former Yankee Russell Martin, who came in batting .172, went 2-for-5 with two home runs and three RBIs. Although Ivan Nova (3-2) took the loss, it was Shreve who did much of the damage. He let an inherited runner score in the seventh and gave up a pair of two-run homers to put the game out of reach.

The Yankees took a 1-0 lead in the third but could have done significantly more damage after getting the first three batters on. Headley singled and Didi Gregorius and Aaron Hicks walked before Marco Estrada coaxed a shallow flyout to left from Jacoby Ellsbury. Brett Gardner’s fielder’s choice brought in Headley, but Carlos Beltran’s long flyout ended the inning.

They’d come back to regret the runs that got away, because in the fourth a series of miscues led to a pair of runs for the Jays. After two quick outs, Kevin Pillar and Devon Travis had infield hits, although Travis’ ball looked to be playable after Headley fielded it but lost it in transition. Ryan Goins made the Yankees pay five pitches later when he drove Nova’s fastball to the gap in right-center, scoring Pillar. With Travis barreling toward the plate, Gregorius’ throw tipped off Brian McCann’s mitt to give the Blue Jays the 2-1 lead.

Martin tacked on a solo shot to left to lead off the sixth, his first homer of the season, for the 3-1 lead. With two outs in the seventh, Nova nicked Edwin Encarnacion with his 107th pitch, opening the door for Shreve, and giving the Jays yet another shot at some two-out damage. Shreve’s 3-and-2 slider to Michael Saunders was deposited into the stands in right for a two-run homer. The next batter, Justin Smoak, doubled, bringing up Martin, who apparently missed his old digs. He smoked another slider to right for another two-run shot, giving the Blue Jays the 7-1 lead.

Back-to-back solo homers by Headley (his third) and Gregorius (his fourth) in the seventh cut Toronto’s lead to four, but the Jays got one back in the eighth on Edwin Encarnacion’s RBI single. Austin Romine’s pinch-hit homer in the ninth provided the final margin.

Though not terrible, Nova’s start was an aberration from his recent string of notable successes. He went 6 2⁄3 innings, allowing four earned runs and seven hits, with two walks and eight strikeouts. After starting the season in relief, he gave up only one earned run in each of his first three starts — his longest being his last, a 4-1 win over the A’s in which he allowed four hits in six innings.