Third-string Jets QB Greg McElroy makes a touchdown pass to Jeff Cumberland to put Gang Green on top of the Cardinals in their 7-6 win today at MetLife Stadium. Photo: Jeff Zelevansky

Backup QB Greg McElroy celebrates with Konrad Reuland after throwing his first touchdown in the NFL, to Jeff Cumberland. (Getty Images)

A Jets quarterback controversy finally broke out today — just not the one everyone has been waiting for.

Rex Ryan benched Mark Sanchez in the third quarter of the Jets’ 7-6 win over the Cardinals, replacing him with Greg McElroy — not Tim Tebow, who was inactive for the game.

McElroy led the Jets, who had been struggling mightily on offense, on their only touchdown drive, a 10-play, 69-yarder that was capped with a 1-yard pass from McElroy to tight end Jeff Cumberland on a rollout.

“I felt I needed to make a change,” Ryan said. “That’s why I made it. I’ll always do what I think is in the best interest of our football team and try to find ways to win. At the time, I thought it was time to make a change.”

The Jets improved to 5-7 and kept their slim playoff hopes alive. They are two games behind the Steelers for the final AFC Wild Card berth with four games left. The Steelers hold the tiebreaker.

The quarterback switch came during the middle of one of the ugliest offensive games you’ll ever see. Both teams traded punts and turnovers in the first half with quarterback play that would make Don Coryell cry. Sanchez threw three interceptions in the first half, including one on the first play of the game. Cardinals rookie Ryan Lindley could barely complete a pass.

Ryan watched Sanchez struggle through three series in the third quarter. With the Jets trailing 3-0, Ryan finally gave offensive coordinator Tony Sparano the order to make the switch after Arizona defensive end Ronald Talley batted down Sanchez’s third-down pass.

Sparano told Sanchez, who sought out Ryan on the sideline to find out if it was really true. Sanchez then put his helmet down, threw on a baseball cap and grabbed the clipboard. McElroy began to throw behind the Jets bench, drawing the loudest cheer of the day from a MetLife Stadium crowd that showered Sanchez with boos.

“Of course you want to be in the game,” Sanchez said. “I’ve been in a situation like that before. It was a learning experience. We’ll move on and do exactly what Greg does for me and that’s support him, chart the plays, give him my insight from the sideline and do my best to help us win, whether you’re on the field or off.”

Ryan would not say who his starting quarterback will be next week when the Jets travel to Jacksonville to play the Jaguars. It would be stunning if the Jets went back to Sanchez, their starter for the last four years. After the game, he and Ryan had an animated discussion at his locker with Sanchez looking very unhappy.

The irony is a quarterback controversy has been brewing around the Jets since they traded for Tebow in March. There have been tons of opinions expressed, questions asked and airtime filled with Sanchez/Tebow debates. Sanchez was inactive yesterday after Ryan decided to give him a week to rest his ribs. That led to McElroy, the team’s seventh-round pick in 2011, being active for the first time in his career.

Conspiracy theorists will ask whether Ryan used Tebow’s ribs as an excuse to keep him out, wanting to play McElroy instead. Tebow was active 10 days prior against the Patriots with the same injury, but never entered the game.

McElroy began throwing with just under seven minutes to go in the third quarter. The Jets had scored no points and gone three-and-out on two of the first three drives of the second half. McElroy jogged onto the field with 4:48 left in the quarter to the strands of “Sweet Child O’Mine” and the crowd erupted. Things immediately seemed to change for the Jets. He threw only four passes on the drive, but suddenly calls went the Jets’ way, the running game picked up and the momentum swung.

“It was fun,” McElroy said. “We were having a good time. It was exciting to get a shot and go in there.”

McElroy said there had been no indication during the week that he would play. He worked the entire week with the scout team, running the Cardinals offense in practice.

After the touchdown, the Jets defense did the rest. Arizona went 0-for-15 on third down and held Lindley to a 28 quarterback rating.

The win keeps the Jets’ season alive for another week. One more loss and they know the playoffs are out of reach. Now, they may have a different quarterback leading them. McElroy has impressed the veterans in his limited time here.

“He’s a pretty confident kid,” guard Brandon Moore said. “Borderline cocky. But you kind of like that in a quarterback. Guys understood that we’re gonna have to rally around him and guys were gonna have to make plays and the huddle got tighter. That’s kind of what happened.”