Ipswich lost their first game under new manager Paul Cook as Vadaine Oliver scored twice in seven minutes to earn Gillingham a 3-1 victory at Priestfield.
The hosts took an early lead when Jack Tucker volleyed home his first league goal after Robbie Cundy had diverted Tom O’Connor’s free-kick into his path.
Gillingham dominated but the Tractor Boys almost grabbed an unexpected equaliser on the half-hour mark when Troy Parrott’s overhead kick hit the post.
An unmarked Olly Lee should have doubled the lead after 63 minutes when he met Ryan Jackson’s throw but headed straight at former Gills goalkeeper Tomas Holy.
That miss looked like proving costly two minutes later when Luke Chambers looped his header from Josh Harrop’s free-kick over goalkeeper Jack Bonham to equalise with Town’s first attempt on target.
Gillingham retook the lead when leading scorer Oliver capped a brilliant counter-attack to meet Kyle Dempsey’s cross and fire past Holy.
After Ipswich substitute Kayden Jackson headed against the bar, Oliver wrapped up Gillingham’s victory with a stunning curling effort 10 minutes from time.