Rochdale's League One play-off hopes were dented by Ian Henderson's late winner for Colchester.
Dale striker Chris O'Grady was busy early on as he headed Nicky Adams' cross just wide before forcing Ben Williams into a smart save.
Ashley Vincent's deflected effort was the hosts' best chance of a timid first-half performance.
Henderson came off the bench to plant his first-time shot past Owain Fon Williams from close range to win it.
Rochdale remain in seventh place in the table, two points behind sixth-placed Bournemouth with a game in hand.
With the win, Colchester leap-frog Brentford into 10th place.
Colchester United manager, John Ward told BBC Essex:"It has taken us 87 minutes of really hard work to win the game.
"I have really enjoyed the tactical work, working out how we could win the match and so for us to get that break has pleased me.
"It had to be thought about, it had to be disciplined and it had to be very much together."
Rochdale manager Keith Hill told BBC Radio Manchester:"We didn't get what we deserved, I thought we deserved a point and I would have been happy with one.
"I never saw our goalkeeper in any danger but unfortunately we've made a mistake which has cost us the game, but we'll recover from that.
"You can't hesitate, that's what happens and we've lost the game but haven't lost the season."