Hansbrough scored 21 points despite fouling out with over 8 minutes left, and Notre Dame (No. 7 ESPN/USA Today, No. 8 AP) held off Walker and the 16th-ranked Huskies 70-67 on Saturday.
"I love all my teammates and I was just thrilled for them to go out and get it done," Hansbrough said. "It means a lot for me."
Walker scored 34 points but missed a 3-point attempt with 8 seconds left and UConn trailing 69-67. Donnell Beverly also fumbled away a pass just before time ran out.
Carleton Scott and Tyrone Nash each had 13 points for the Fighting Irish (25-5, 14-4), who kept alive their hopes for a share of the Big East title. They closed the regular season with four straight wins and have won 11 of 12 overall.
UConn (22-9, 9-9), which has lost four of five, will have to play Tuesday in the opening round of the conference tournament.
Notre Dame equaled the most conference wins in school history, matching the 2007-08 team. It entered one back of Pittsburgh for the top spot in the Big East but already had secured a double bye for next week's tournament.
Hansbrough hit his first seven shots before missing a jumper six minutes into the second half. But two minutes later, with Notre Dame up 54-46, he picked up his fourth foul guarding Walker.
He came back in with 8:34 left and fouled out 10 seconds later with his team up 60-52, pushing Shabazz Napier with his shoulder while trying to get free on offense.
"Ben Hansbrough is a 23-year-old fifth-year senior and I put him in on an offensive possession," Notre Dame coach Mike Brey said. "He's got to be better."
That sent the crowd into a frenzy and UConn scored the next 13, part of a 15-0 run. A steal and layup by Napier gave UConn a 61-60 lead with 5:41 left.
The Huskies led 65-60 before Notre Dame responded. Tim Abromaitis put the Irish back in front 67-65 and the Irish held off UConn the rest of the way.
Abromaitis had 11 points for the Irish, who had lost seven straight at Connecticut, where Abromaitis' father starred.
"[Winning here] is something I needed to experience, not knowing if we're going to play here again next year," he said. "To be able to put it away in the end was something that was really fun for me and one of the greatest experiences I'll have in college basketball."
Walker and Hansbrough, two of the top candidates for Big East player of the year, each got off to a nice start.
Walker scored UConn's first seven points to help the Huskies jump out to an early six-point lead, but Hansbrough connected from long range for his first basket midway through the first half, putting Notre Dame ahead 19-18.
The Huskies put together an 11-2 run, capped by an alley-oop pass from Napier to Lamb, to build a five-point advantage and carried a 36-33 lead into halftime.
Before the game, Connecticut honored seniors Donnell Beverly, and Charles Okwandu, and Walker, who is a junior.
Walker is scheduled to graduate this summer and will walk in May at commencement. Walker said the decision to participate in Senior Day festivities doesn't necessarily mean he will be leaving for the NBA after this season, though he is expected to be a first-round draft pick.
He had one of his better games, hitting 11 of 22 shots and playing all 40 minutes.
"I just wanted to win," Walker said. "It would have been a big win for us, but we didn't get it, so now we just have to look forward."
Only one other UConn player, Emeka Okafor, has been honored as a junior. He graduated early before entering the NBA draft.
Connecticut coach Jim Calhoun ended the season still looking for his 300th conference win. He is 299-173 in conference play.
Nike Men's UConn Huskies Blue ELITE Basketball KO Performance Pullover HoodieShop
The NBA draft is Thursday night (7 ET, ESPN/WatchESPN), and trade talk is picking up. Chad Ford dishes his latest intel on how the draft will go and which teams will make deals.
Jemele Hill and Michael Smith discuss Tracy McGrady's comments on Ben Simmons' standoffish demeanor. Hill wonders if the "LeBron label" has impacted Simmons for the worse.
Get to know the NBA's next crop of superstars.