The Eagles' season died several times Thursday night, but it came back to life emphatically when Boston Scott reeled in an 18-yard Carson Wentz pass and dived inside the right pylon with 40 seconds remaining in a 22-21 victory over the visiting New York Giants.

Scott, playing a featured role with Miles Sanders sidelined by a knee injury, reprised his 2019 heroics, when he was a huge factor in a pair of December wins over the Giants, scoring four touchdowns.

“I just checked my protection, and then after that, I just got out into space,” said Scott, who found the ball floating in over his left shoulder, having gained a step on Giants safety Jabril Peppers. Scott said he’d run a lot of “short routes into the flat” and that Peppers followed him each time. This was a longer route. “[Wentz] went to me, so that was cool,” Scott said.

The play before the touchdown, Jason Kelce, the bulwark of the offensive line, took a 15-yard facemask penalty, turning what would have been second-and-goal from the 3 into first-and-goal from the 18.

Wentz looked amused when a questioner wondered if having more space to work with helped him throw the winning TD pass.

“I guess you could look at it that way,” Wentz said. “That was a tough penalty to have, and Kelce felt terrible about it. ... We had to find a way to make a play, and sure enough, the next play, we did. I wouldn’t say it was advantageous for us, by any means.”

Wentz said Scott "wasn’t the primary read on that play. The way it happened, I stepped up in the pocket. The guy had pretty good coverage, but giving Boston a chance there to make a play, and he did.

“He plays bigger than whatever he is -- 5-7? [Actually, 5-foot-6]. He plays bigger than that.”

The now 2-4-1, NFC East-leading Eagles found themselves trailing the now-1-6 Giants by 11 points past the midway point of the fourth quarter. They did not make any sort of statement to the national TV audience about their viability as a real contender, but they did show that they still might be capable of climbing to the top of the divisional garbage heap, when a few more regulars get healthy.

In the final seconds, relentless Brandon Graham forced a Daniel Jones fumble, the Giants’ third turnover of the night, and Vinny Curry recovered.

Shakily, the Eagles won a game they several times showed themselves unworthy of winning.

The most egregious moment in that regard might have come on the second play of the fourth quarter, when on fourth and goal from the Giants' 3, the play Doug Pederson came up with to take the lead in a game his team should have been dominating was an end-zone fade to Hakeem Butler.

Butler is a 24-year-old veteran of the Arizona Cardinals, and the Carolina Panthers' practice squad, who had not played an offensive snap in the NFL going into the game. Not surprisingly, he was manhandled by the Giants' Logan Ryan, got no flag, and watched the pass fall incomplete. But karma turned on Ryan, who later took a defensive holding penalty that helped set the table for the Eagles' winning touchdown.

“Initially, [Butler] was heading to the wrong side of the field,” Pederson said. "When he got back over to the right side of the formation, he was uncovered. When we snapped the ball, the defender had gotten back over there just in enough time to knock the ball away.

“[Butler] is a big, athletic guy, and we put that play in specifically for him, and the Giants made a play.”

After the Butler didn’t do it, the Giants drove 97 yards to take that 11-point lead.

Earlier, it started out like it was going to be the Eagles’ night, even if that was hard to remember a few hours later. Despite a jumbled offensive line that had Sua Opeta making his first NFL start at left guard, the Eagles looked like the Eagles of preseason expectations on their first drive -- 11 plays, 75 yards, Wentz 1-yard TD run. The first Eagles first-drive touchdown since the season opener included two catches for 19 yards and a first-play, 12-yard jet sweep run by DeSean Jackson, returning from a hamstring injury suffered Week 3 against the Bengals.

Jackson left the game with two minutes, two seconds remaining in the fourth, at the start of the winning drive, when he went down on a punt return and was slammed by Madre Harper. Jackson’s leg was bent backward as he lay on the ground. He was helped to the locker room.

Lane Johnson, playing despite a lingering ankle injury, left for a couple snaps on that first drive but returned, only to leave early in the fourth quarter with a knee injury, apparently suffered on the ill-fated Butler play.

The Eagles held a 10-7 lead in the second quarter when Jalen Mills made a great catch off a deflected Jones pass, and the Eagles were driving for more points. Wentz then threw an inexplicable interception, an early season problem he seemed to have put behind him the past two weeks.

Wentz was running for his life after Jordan Mailata couldn’t hold his block. He heaved the ball for the end zone. If the Eagles had been losing in the final seconds of the game, it would have been an OK thing to do. On second and 15 from the Giants' 20, with 4:46 left in the half, it was a very strange thing to do, and it probably cost the Eagles at least three points.

Corner James Bradberry had plenty of time to square up and leap for the ball, as intended receiver John Hightower struggled to get within hailing distance of the throw.

Pederson lauded Wentz’s toughness and leadership afterward, but he also noted “some throws and some decisions he’d want back.”

The offensive line continued to look shaky in front of Wentz. Opeta took a holding penalty deep in Eagles territory that the Giants declined so they could get the ball back before halftime.

That decision by Giants head coach and Lansdale native Joe Judge nearly turned into a disaster, when on the Giants' second snap, former Eagle Dion Lewis fumbled and Rodney McLeod recovered. Fletcher Cox tackled Lewis and was initially credited with forcing the fumble; on replays, it seemed that a Josh Sweat swipe knocked the ball loose.

So the Eagles went to work from New York’s 42, and quick completions to Jackson and to Travis Fulgham moved them to the Giants' 11 with 33 seconds remaining in the half.

The Eagles we expected to see this season would have scored a touchdown. These Eagles tried to squeeze three successive passes into the back of the end zone, none of which came close to being completed. With two timeouts remaining, they could have tried a run or even a pass that didn’t go to the back of the end zone, but they did not.

The consolation prize field goal and what would have been a 13-7 Eagles halftime lead didn’t look all that appealing, but considering how the season has gone, it looked better than nothing. This being that kind of year, though, Elliott, perfect (6-for-6) from inside 50 yards coming into the game, hooked the kick to the left. Elliott had never missed inside 30 yards (20-for-20).

So it was 10-7 Eagles at the half, and the home team had no points to show for a pair of Giants turnovers. First downs were 15-5 in the Eagles' favor.

Wentz, who came into the game having taken a league-high 25 sacks, went down three more times in the first half, but was not sacked in the second half.

Both offenses sputtered and stalled. It was starting to look like the 10-7 lead might hold. Then Jones faked a handoff and took off around the left end on first down from his own 12. He fooled all the Eagles, including corner Nickell Robey-Coleman, who was more or less right in front of him and probably wondered why the quarterback would be sprinting down the field.

This being the NFC East, Jones tripped and fell at the Eagles' 8 with no pursuers nearby. It was an 80-yard quarterback run. Robey-Coleman made sure this lack of finish wasn’t a problem for the Giants by committing a blatant pass interference penalty on third and goal from the 3.

Wayne Gallman’s dive over the line gave the Giants their first lead, 14-10, with 6:45 left in the third quarter. They took that lead into the fourth.

The Eagles seemed to be about to take that lead back when they got a first down at the Giants' 9 near the end of the third. But they ended up with fourth-and-goal at the 3, and tried the Butler play.

Then the Giants drove 97 yards in 15 plays and seemed to put the game away, with Jones hitting Sterling Shepard for the 2-yard touchdown, and Shepard besting Darius Slay. Slay had his worst game as an Eagle.

But Wentz found Hightower for 59 yards, setting up a 3-yard touchdown pass to Greg Ward that made it 21-16. New York’s Harper incurred a personal foul, so the Eagles got to try for two points from the 1.

Pederson lined Wentz up in the shotgun and had him try the right side. This did not work.

But the next drive was six plays, 57 yards -- after the Giants' personal foul on the play that took Jackson out of the game -- and Wentz made the throw he needed to make to keep the talk-radio sky from falling.

“We’d love to not be in those situations, where our backs are against the wall,” Wertz said. “We left a lot of plays out there. We were in the red zone a lot [3-for-8] and didn’t score many points, so those are things we’ve got to clean up and get better.”