ANNAPOLIS, MD - OCTOBER 8: Navy linebacker Josiah Powell (58) intercepts a pass from Houston quarterback Greg Ward Jr. (1) for a third quarter touchdown on October 8, 2016 in Annapolis, MD. (Photo by Jonathan Newton / The Washington Post) (Jonathan Newton/The Washington Post)

It had been more than 30 years since Navy beat a program ranked as highly as No. 6 Houston. Shorthanded and coming off a disheartening loss last week, the Midshipmen were unbowed against the Cougars on a rainy afternoon in Annapolis, stunning the Cougars, 46-40, for one of the most improbable upsets in program history.

As the final whistle sounded, the brigade of midshipmen rushed the field to celebrate with the team following its first victory over an opponent ranked this highly since a 38-21 victory over No. 2 South Carolina in 1984. The Midshipmen forced three turnovers, most notably a pair of interceptions of heralded quarterback Greg Ward Jr., on the way to their second win against a top 15 opponent in two years.

An announced crowd of 34,531 at Navy-Marine Corps Memorial Stadium witnessed Navy gain 306 rushing yards, including 115 and a touchdown on 17 carries from quarterback Will Worth — against the top-ranked run defense in major college football. A week ago in a 28-14 loss to Air Force in the first leg of the Commander-in-Chief’s Trophy competition, the Midshipmen managed 57 rushing yards, their fewest since 2002.

Houston, meanwhile, had been allowing just 42 rushing yards per game.

“Nobody gave us a chance,” Navy senior slot back and co-captain Toneo Gulley said. “We just had to believe in ourselves and get it done.”

Navy took over first place in the American Athletic Conference West Division by exacting redemption for a 52-31 loss to the Cougars last season. The Midshipmen (4-1, 3-0) won for the sixth time in seven games despite playing without starting linebacker Daniel Gonzales. The senior co-captain had been Navy’s leading tackler but is out for the season with a Lisfranc injury suffered last week.

The Midshipmen also lost two significant contributors in the first quarter against Houston (5-1, 2-1) when starting fullback Chris High and reserve slot back Calvin Cass Jr. left the game with injuries on consecutive plays. High walked off the field gingerly with a sore hip, and Cass departed following absorbing a blow to the helmet. Neither returned.

“I just love my team,” Navy Coach Ken Niumatalolo said. “Just great kids. I am so fortunate and blessed to be able to coach these guys. Sometimes you get your butt whipped, and you move on. I’m just so proud of the way our guys responded after such a difficult, heart-wrenching, gut-blowing loss last week.”

A safety when Cougars long snapper Byron Sampson snapped the ball out of the end zone on a punt attempt helped Navy forge a two-score advantage. Then one minute later, Navy place kicker Bennett Moehring’s 40-yard field goal produced a 46-33 lead with 4:38 to play.

After Houston drew within 34-27 on Ward’s eight-yard touchdown run early in the third quarter, the Midshipmen countered with an 80-yard scoring drive on seven plays. Worth capped the series with a 34-yard touchdown pass to junior wide receiver Brandon Colon, who beat safety Khalil Williams and linebacker Matthew Adams over the middle for a 41-27 lead.

The Cougars scored on their next possession thanks to running back Dillon Birden’s two-yard rush, but linebacker D.J. Palmore deflected place kicker Ty Cummings’s point-after attempt to keep the margin at eight with 13:18 left. The junior’s outstretched right hand produced Navy’s first extra-point block since 2010.

Linebacker Josiah Powell, who this week switched to jersey No. 58 in honor of Gonzales, put Navy ahead 34-20 with 10:02 remaining in the third quarter when he stepped in front of Ward’s pass for an interception that the senior returned 34 yards for a touchdown. Powell raced into the end zone untouched, yielding the Midshipmen’s second touchdown in 61 seconds.

Minutes earlier, a strip sack by of Ward by junior defensive end Tyler Sayles set up the Midshipmen at the Houston 41. Nose guard Patrick Forrestal recovered the loose ball, and on the first snap, slot back Dishan Romine ran for an 11-yard gain. Navy soon after reached the Houston 17, and from there Worth completed a touchdown pass to slot back Darryl Bonner.

Worth faked a toss to the right immediately before the scoring throw, drawing defenders toward the line of scrimmage. That bit of subterfuge allowed Bonner to come wide open over the middle for the first touchdown of his career with 11:03 to play in the third quarter.

Navy claimed its first lead at 17-13 when Worth scored from two yards to cap a 71-yard drive with 10:33 to go in the first half. The possession included a 20-yard run by Worth, who has scored at least one touchdown in every game this season, and Gulley’s 19-yard carry not long after the Cougars got a 26-yard field goal from Cummings.

“For the program, I think this gives everyone confidence in us, like our fans, people who support us, because last week was a tough loss,” Palmore said. “With that said, it’s always tough to beat the other service academies. We came back with our heads down a little bit, but we knew coming into this game that everyone in our conference is beatable. We took that mentality into practice, and it paid off.”