Longstaff grabbed his fourth goal in 11 appearances for Mansfield Town, but the Stags were beaten 3-2 by Sutton as their 11-game winning home run came to an abrupt end.
The 22-year-old Newcastle loanee played the full match and scored in the sixth minute of stoppage time, but it wasn't enough to earn Nigel Clough's side a point.
They remain in the League Two play-off positions - but dropped below Joey Barton's Bristol Rovers, who are now fifth thanks to their 1-0 home victory over Salford.
Teenager Anderson's fifth goal in blue and white secured the points and arrived in the 75th minute as he fired low beyond visiting goalkeeper Tom King.
Earlier on Friday, it had been announced that Anderson's superb strike against Harrogate had been voted as the League Two goal of the month for March.
In the same division, Joe White was a 73rd-minute for Hartlepool as they lost 1-0 at home to Port Vale. Meanwhile, in the Championship, Freddie Woodman was an unused substitute for AFC Bournemouth as they drew 0-0 with Middlesbrough while Jeff Hendrick missed Queens Park Rangers' trip to Huddersfield.