The Cornhuskers looked like they were finished after Northwestern took a three-point lead with 1:20 left. They started their final drive at their 17 with no timeouts.
Ameer Abdullah caught a short pass and stretched to convert a fourth-and-15. Then, with four seconds on the clock, Kellogg dropped back for a final play. The strong-armed Kellogg let fly a ball that was tipped by Northwestern's Anthony Walker in the end zone. Westerkamp was there to snatch it, bringing the entire Nebraska bench running onto the field in celebration. The play was confirmed on video review.
Jeff Budzien had kicked a 21-yard, tie-breaking field goal with 1:20 left after defensive lineman Tyler Scott's interception set up Northwestern inside the Nebraska 10.
Nebraska's winning play was perhaps its most dramatic since Matt Davison's "Miracle at Missouri" catch that kept alive the Huskers' national-championship season in 1997.
Kellogg, who came into the season as the third-string quarterback, was backing up Tommy Armstrong Jr. in the absence of the injured starter Taylor Martinez.
The Huskers' previous series ended with Armstrong, trying to hit Quincy Enunwa, instead firing a pass right into the hands of Scott.
Kain Colter had run 6 yards to the Nebraska 1, but the Wildcats' struggling offense couldn't get into the end zone and had to call on Budzien for the short field goal.
Coach Bo Pelini has said that if the Huskers ever needed to drive the field in the final 2 minutes, Kellogg would be the guy he called on.
Kellogg, a walk-on who wasn't put on scholarship until August, came through in a big way for a Nebraska team whose season was teetering after last week's loss at Minnesota. The Huskers avoided back-to-back conference losses for the first time since 2009.
The Huskers (6-2, 3-1 Big Ten) continue to control their own destiny in the Big Ten Legends Division. The Wildcats (4-5, 0-5) lost their fifth straight.
Abdullah ran 24 times for 127 yards, but his biggest play came when the Huskers were trying to keep their last drive alive. Kellogg was in trouble on fourth-and-15 when he dumped the ball to Abdullah, who fought his way to the first-down marker and even got an extra yard.
Armstrong was 15 of 29 for 173 yards and a touchdown, but he threw three interceptions.
Kellogg was 7 of 13 for 104 yards, with one interception and the winning touchdown.
Treyvon Green ran for 149 yards and a career-high three touchdowns for the Wildcats, who have lost five straight and were playing without injured running backs Venric Mark, Mike Trumpy and Stephen Buckley. Buckley injured his left knee in the first quarter and didn't return.
Nebraska defensive end Avery Moss tied it 21-all in the middle of the third quarter, picking off Trevor Siemian and running 25 yards for a touchdown.
In 11 possessions after it went up 21-7, Northwestern punted 10 times and was intercepted.