Dereham came out on the wrong side of a five-goal clash at Aldiss Park.
The Magpies went behind but took an interval lead, only for the visitors to peg them back and then snatch a winner just 10 minutes from time.
The Magpies had a sighter after just six minutes when keeper Ollie Bowles spilled Danny Beaumont's 20-yard free-kick only for defender Leon Smith to clear.
Thamesmead's Becka-Kah Dembele fired over home keeper Josh Glover's goal before the Mead took an 11th-minute lead. Ellis Green gained possession deep inside the home box and squared the ball to Ellis Brown who netted from close range, despite a valiant effort from defender Dion Frary to block his shot.
The visitors continued to press and won another free-kick just outside the box – Dembele fired inches wide of the target.
Dereham were finding it difficult to build on the heavy surface, but Rhys Logan, back after suspension, combined well with Joe Gatting before delivering a cross from the right that keeper Bowles just managed to grasp.
Logan went on another run down the right, winning a corner. Harley Black found Logan who chipped the ball towards Ryan Crisp, whose firm glancing header made it 1-1 with 33 minutes on the clock.
Gatting then curled a free-kick over as Dereham began to dominate and they were rewarded in the 41st minute when Crisp played a neat one-two with Gatting before slipping the ball past the keeper.
The Magpies started the second half strongly, although Dembele saw a superb 30-yard curler rattle the bar.
The equaliser came in the 61st minute when keeper Glover started to come for a cross from the left then back-pedalled, allowing Becka-Kah Dembele to nip in and nod home from close range.
Another followed on 80 minutes when Alex Teniola rose well to head home. The visitors were reduced to 10 men
late on when Bode Anidugbe was dismissed for a second bookable offences.
Dereham: Glover, Eastoe-Smith, Black (Green 6), Costandachi, Frary, Morphew, Logan (Sainsbury-Logan 79), Smith, Gatting, Crisp, Beaumont (Dodden 88). Sub not used: J Grant. Att: 149
Comments: Our rules
We want our comments to be a lively and valuable part of our community - a place where readers can debate and engage with the most important local issues. The ability to comment on our stories is a privilege, not a right, however, and that privilege may be withdrawn if it is abused or misused.
Please report any comments that break our rules.
Read the rules here