Paul Anderson salvaged a point for Swansea as they went to the top of League One after denying new Gillingham boss Mark Stimson a winning start.
On-loan winger Anderson converted Darren Pratley's cross in the 79th minute to extend their unbeaten run to seven games and overhaul Carlisle at the summit.
But they were denied maximum points in the dying seconds after Gills goalkeeper Simon Royce kept out Andy Robinson's spot-kick.
Delroy Facey's early thunderbolt looked to have sent promotion hopefuls Swansea crashing to defeat and were left reeling when striker Warren Feeney saw red for a wild first-half lunge on Simon King.
But Anderson popped up with the leveller, and only Royce's last-gasp heroics ensured the struggling Gills picked up their first point on their travels.
Swansea made one change from the side that won at Yeovil last time out, with the fit-again Leon Britton replacing the injured Ferrie Bodde in midfield.
Stimson called in last week's matchwinner David Graham in place of Chris Dickson in attack, while Duncan Jupp was ruled out so Garry Mulligan stepped into the stating line-up.
Royce made amends for spilling Thomas Butler's weak shot by blocking Feeney's rebound attempt in the opening minutes.
But Gillingham took the lead when Facey latched onto Dennis Lawrence's poor clearance before unleashing a 25-yard thunderbolt beyond Dorus de Vries in the ninth minute.
It almost got worse for the shell-shocked hosts when only a quick reflex save kept out Mulligan's shock after seizing on Gary Monk's sloppy back pass.
Pratley's long-range effort then brought the best out of Royce before the game's turning point arrived when Feeney was dismissed for a wild lunge on King.
Gillingham almost made their numerical advantage count immediately when Mark Bentley's header brought a fine save out of de Vries.
The under-fire official incurred the wrath of the Swansea supporters in the 50th minute when he disallowed Efe Sodje's own goal after ruling Lawrence had pulled down Royce.
Despite being one-man down, the Swans continued to test Royce who was kept busy.
Anderson's goalbound shot was deflected over and substitute Robinson came close.
But Swansea finally got the equaliser they deserved when Anderson converted Pratley's cutback in the closing stages before the late drama.