Enoch Showunmi's late effort ensured Bristol City bounced back from a midweek setback to clinch three points at Crewe.
Gary Johnson's side closed the gap on League One leaders Scunthorpe, but they were far from convincing after starting without leading scorer Phil Jevons.
Showunmi's settled a dour encounter by forcing home an 85th minute corner which substitute Liam Fontaine glanced goalwards.
Danny O'Donnell hooked the header off the Crewe goalline, but the Nigerian made sure by chesting the ball in from close range.
There were few chances for either side in a scrappy game, although City looked at ease controlling play in the first period.
Crewe had their moments on the break, but at times they tried to overplay their way on a pitch which looked the worse for wear.
Alex Russell thumped an early header a yard wide of the near post from a Brian Wilson cross.
And Wilson tested home keeper Ben Williams at his near post, before Julien Baudet offered Crewe's first threat - a thumping downward from Ryan Lowe's corner which Adriano Basso got behind safely.
Strike duo Andy Smith and Showunmi wasted a good chance when Williams made a mess of a cross with Showunmi blazing a follow-up effort well wide.
The poor finishing was contagious as home striker Mike Higdon shot tamely past the post when he should have taken the ball on into the box.
Rodney Jack's darting run to the byline raised the tempo, but the little striker saw Basso hold on to his effort by sandwiching the ball between his legs.
Showumni wasted another one when he ran on to Wilson's lofted pass in the 63rd minute, but lifted tamely over at the far post.
But Higdon dragged another chance wide and Bristol's physical strength was beginning to tell as the game wore on.
Finally, from Lee Johnson's late flag kick, Fontaine set up the chance for Showunmi to pounce for the winner.