Jonathan Douglas hit the bar in the last minute as Gillingham and Ipswich played out a 0-0 draw on a bumpy Priestfield pitch.
The Gills will be delighted to have finally escaped the bottom three for the first time in five months as they extended their unbeaten run to five games, despite wasting the better chances.
Ipswich's hopes of reining in Wigan and Sunderland in the chase for the automatic promotion places received a blow with the loss of two points.
Richard Naylor had a golden opportunity to open the scoring after ten minutes when he arrived late in the box to meet Darren Currie's free-kick unmarked, but failed to trouble the returning Jason Brown in the Gillingham goal.
It was a half of few chances but should have yielded a goal for the home side when Mamady Sidibe latched on to a Darius Henderson flick 12 yards out only to place a tame side-footer wide with only Kelvin Davis to beat.
Davis came to Ipswich's rescue four minutes from half-time, tipping a venomous shot from on-loan Douglas over the bar.
The game improved after the break as Ipswich switched to 4-4-2 and tried gamely to kick-start their passing game on a difficult uneven pitch.
But it was Gillingham who came closest to scoring as Davis was forced to make a fingertip save from a low Michael Flynn cross shot.
Henderson and Sidibe were both proving a handful but neither could find their range in front of goal with a series of haphazard strikes troubling only spectators and photographers behind the Ipswich goal.
Douglas came within a whisker of connecting with an inviting right-wing cross from Nicky Southall but failed to make significant contact on the ball with the goal gaping.
Sidibe could have snatched the points two minutes from time after a rare mistake by the otherwise excellent Jason de Vos, but stumbled as he tried to round Davis from a tight angle and ran the ball out of play.