Bristol City rode their luck before Aden Flint's sixth goal of the season in stoppage time secured a 2-1 win over 10-man Sheffield United at Bramall Lane.
United, who went into the match fourth and level on points with third-placed City, were denied by post and crossbar four times during a gripping contest.
Billy Sharp twice came agonisingly close, as did Mark Duffy, with the hosts dominating for long spells during the first half before City struck first – Jamie Paterson lashing home a brilliant, curling strike from the edge of the area.
Leon Clark found a similarly emphatic finish at the end of a driving run three minutes into the second half to level it up and Duffy saw Frank Fielding push his header on to the bar before Flint blocked bravely from Sharp on the rebound.
United's task then became tougher in the 59th minute when John Fleck was rightly red carded for a reckless two-footed lunge on Korey Smith, who made way for Matty Taylor through injury.
It was left for the ever-reliable Flint to have the final word in the 91st minute, coolly dispatching Bobby Reid's cross and closing Lee Johnson's team to within three points of rivals Cardiff in second.