Byron Moore's dramatic stoppage-time penalty clinched Crewe a 1-0 victory as hapless Bristol City's winless league run this season was extended to 12 matches.
The game looked destined to end goalless until Moore was brought down on the edge of the penalty area by City defender Derrick Williams.
After the referee had pointed to the spot, the winger duly stepped up and sent City goalkeeper Elliott Parish the wrong way.
Crewe should have had the game sewn up well before injury time though as they missed a catalogue of first-half chances.
Moore rattled the crossbar with a rasping drive that forced Parish into a fantastic save, while the visiting keeper prevented Oliver Turton from scoring at his near post.
After the break, Turton again came close from Matt Tootle's cross, while Lee Molyneux fired off target with several long-range efforts.
City's best chance came midway through the opening period when Jay Emmanuel-Thomas robbed the ball from Mark Ellis and was left one-on-one with Phillips, but he could only find the side netting.