The Aztecs' Donny Hageman was wide right on a 34-yard field goal attempt with 20 seconds left. Hageman had made his first three field-goal attempts.
The winning drive for Navy (8-5) was set up when Donnel Pumphrey, who earlier set San Diego State's single-season rushing record, fumbled at midfield.
Fullback Chris Swain converted on a fourth-and-one play and Ryan Williams-Jenkins took a pitch and ran 28 yards to help set up the game-winner by Grebe.
Pumphrey gained 112 yards on 21 carries to set the Aztecs' single-season rushing record with 1,867 yards.
San Diego State finished at 7-6.
Marshall 52, Northern Illinois 23: Rakeem Cato capped a record-setting career by tying an NCAA mark for touchdown passes and throwing for three scores for the Thundering Herd in the inaugural Boca Raton Bowl in Florida.
Cato extended his streak of throwing at least one touchdown pass to 46 consecutive games. That tied the NCAA all-division record set by Central Washington's Mike Reilly.
As usual, Cato's favorite target was fellow senior Tommy Shuler, who made 18 receptions for 185 yards and a score. Shuler broke the Conference USA record for career receptions with 322.
Cato increased his season total to a school-record 40 touchdown passes. He threw for scores of six yards to Shuler, 11 yards to Angelo Jean-Louis and 27 yards to Deon-Tay McManus.
All of those touchdowns came in the second half.
Cato completed 25 of 37 passes for 281 yards and ran five yards for a score.
Marshall finished 13-1, with its lone loss to Western Kentucky, 67-66, in overtime. Northern Illinois finished 11-3. The game drew a crowd of less than 15,000 in Florida Atlantic's 30,000-seat stadium.
The Huskies' Drew Hare threw for 225 yards and a score, and they added 200 on the ground. They outgained Marshall in the first half but trailed 24-13 because they settled for field goal tries three times and missed one.