Moody scored his three goals inside 13 second-half minutes but there were jeers as well as cheers for Keegan from the home fans.
Despite losing, North End will play Gillingham in the play-offs, with Manchester City securing third place and a meeting with sixth-placed Wigan after a 4-0 demolition of relegated York at Maine Road.
Paul Dickov, Kevin Horlock, Jeff Whitley and Danny Allsopp scored for City in front of over 32,000 against York, who would have avoided the drop had it not been for Paul Emblen's 83rd-minute winner for Wycombe at Lincoln.
Northampton - who missed out on promotion to the First Division in the play-off final last summer - and Lincoln will be the other teams joining York and Macclesfield in next season's Third Division, with Oldham's 2- 0 victory over Reading proving enough to secure their Second Division status.
Walsall, already promoted in second place, went down 2-0 at Stoke thanks to two goals from Paul Connor, and a Carl Asaba strike helped Gillingham celebrate their play-off berth with a win at Notts County.
Wigan, who have already won at Wembley this season in the Auto Windscreens Shield final against Millwall, could be paying a second visit to the Twin Towers after they beat Chesterfield 3-1. Bournemouth, however, missed out on the play-offs following a goalless draw at home to Wrexham.
In the Third Division, Lloyd Owusu scored in the 61st minute at the Abbey Stadium to hand Brentford the championship in the title-decider against Cambridge. Cardiff follow them into the Second Division despite losing 3-0 at Mansfield. Scunthorpe, Rotherham, Leyton Orient and Swansea will battle it out in the play-offs for the extra promotion berth.
Scunthorpe were made to settle for a play-off spot after Darlington won at Glanford Park. The Irons will play Swansea, who sneaked into the top seven with a 2-0 win against Hull. Rotherham meet Orient in the other play-off tie.