Oldham took a vital step towards finishing in the League One play-off places as Richard Butcher grabbed a dramatic late winner at Boundary Park.
Butcher broke the deadlock deep into injury time and his third goal of the season cut the gap behind Colchester to three points.
The visitors have been badly out of form and their cause was not helped when midfield man Kemal Izzet received his marching orders after 86 minutes.
Izzet received a second yellow card for a bad challenge on Richie Wellens and the 10 men of Colchester were unable to hold on for a point.
It was their seventh game without a win in all competitions and, worryingly for manager Phil Parkinson, they have scored only one goal in that time.
Oldham, however, are on the rise as this was their fourth straight victory without conceding a goal.
Busy midfield man Wellens helped to create the first chance for Oldham as Paul Warne fired at visiting goalkeeper Aidan Davison
Davison also denied Will Haining but Colchester had a great chance to take the lead on 10 minutes when Mark Yeates sent over a pinpoint cross from the left and Izzet blazed over the bar from close range.
Oldham appealed for a penalty after Wayne Brown challenged Butcher and were again frustrated when Wellens hit the post with a shot from 20 yards.
But Colchester almost hit a glorious goal after 28 minutes as Neil Danns played a one-two with Chris Iwelumo and smashed his volley against the woodwork from just inside the box.
It was Colchester's turn to shout for a penalty when Greg Halford appeared to be fouled by Paul Edwards but Oldham defender Guy Branston wasted a good opening from a Wellens corner.
Oldham pushed forward in search of the winner and almost scored through Butcher before substitute Tony Thorpe forced a save at the other end.
The winner came after Chris Taylor and Warne combined down the right for Butcher to move into the box and smash a left-foot shot into the roof of the net.