Tom Hitchcock netted the winning goal in the 76th minute shortly after Chuks Aneke's equaliser had cancelled out the first-half lead given to the U's by Luke Garbutt's strike.
Hitchcock went close with a half-volley early on before Marcus Bean's first-time effort flashed just wide at the other end.
Colchester took the lead after 29 minutes when Garbutt's 25-yard free-kick deflected off the Crewe wall and sailed into the back of the net.
Blair Turgott forced Alex goalkeeper Ben Garratt to save well while U's keeper Sam Walker palmed away Brad Inman's effort just before half-time.
Hitchcock headed over for the visitors early in the second half and came even closer to equalising when Brian Wilson cleared his effort off the line following a mix-up between Walker and defender Magnus Okuonghae.
Crewe deservedly levelled after 73 minutes through Aneke, who side-footed in from 12 yards out after Inman had picked him out in the area.
And less than three minutes later Hitchcock brilliantly headed in from Inman's corner to give Crewe a precious three points.