Michael Chopra's injury-time winner left Coventry City rooted to the bottom of the table and lifted Ipswich Town 10 points clear of the relegation zone.
Jay Emmanuel-Thomas put the visitors in front before Coventry took the lead through a Sammy Clingan penalty and a Gary Deegan finish.
But the Sky Blues were pegged back when Chopra latched onto the rebound from Lee Martin's missed spot kick.
And Chopra secured a dramatic victory with a 95th-minute header.
Ipswich, whose spirits were high after their 5-1 win over West Ham in midweek, were in front in under half an hour when Emmanuel-Thomas's shot took a slight deflection past Joe Murphy.
Coventry were awarded a penalty seven minutes later for Tommy Smith's handball, which Clingan converted.
The hosts then took the lead on the stroke of half-time when Deegan applied a finish to Clive Platt's flick-on.
Keogh was guilty of a foul in the area on Martin, who saw his effort parried by Murphy only for Chopra to follow up.
And the former Cardiff striker was at it again to nod in Andy Drury's cross in the dying moments to leave Coventry seven points adrift of safety.