It means they will face the side managed by former Priestfield boss Tony Pulis, sacked by the Kent club four years ago.
This latest defeat, Gillingham's 12th at home against a side they have never beaten in the league in matches stretching back to 1958, hinged on a poor first-half display with Coventry apparently cruising to victory, 3-0 up.
However, substitute Gary Wales inspired Gillingham's comeback, making it 3-1 and then Mamady Sidibe made it 3-2, shortly after player-manager Andy Hessenthaler was sent off for two bookable offences.
Hessenthaler was booked in the first half for dissent by referee Tony Bates, something that was missed by many in the crowd who were shocked when the Staffordshire official produced the red to accompany a second yellow for a midfield challenge on Michael Doyle.
It heightened the nerves on a frenetic afternoon with Hessenthaler ordered from the bench along with kitman Bob Lewin for words with the fourth official Gavin Ward.
To add to the confusion Gills substitute Barry Ashby was also booked for comments to assistant referee Fred Graham as he warmed up on the touchline.
Coventry boss Eric Black was anxious his team did not allow their season to fizzle out even though they had nothing to play for apart from pride.
They led as early as the seventh minute when Michael Doyle planted a left-footed free-kick wide of Steve Banks, before Andy Morrell added the second after 24 minutes.
However, the goal of the game was scored by Gary McSheffrey just past the half hour. His right-foot curling shot close to the touchline rocketed into the net.
It took his tally for the season to 22 and puts him top of the Sky Blues scorers chart after his three-month loan spell at Luton ended in January.
At 3-2 the game could have gone either way, but another exquisite piece of skill by McSheffrey made it four, while defender Richard Shaw added the fifth with a rasping right-foot drive in stoppage time.
It was Shaw's first goal for the Sky Blues in nearly ten years with the club and capped a demoralising afternoon for the Gills as they reflected on a 12th home defeat of the season.