Play-off hopefuls Colchester sent Championship leaders Sunderland to their first defeat in 18 games.
Wayne Brown put Colchester ahead in first-half injury time, heading home from Kevin Watson's free-kick.
Dwight Yorke drew Sunderland level after 54 minutes, finding space to head home a cross from Daryl Murphy.
Richard Garcia spun to put Colchester back in front with eight minutes left and Jamie Cureton added a penalty after he was fouled by Dean Whitehead.
"For the first 15 minutes of the first half we were under pressure and Sunderland scored a deserved equaliser but our players never know when they're beaten.
"Everyone was magnificent for us and it was a great advert for the Championship."
"When we got back to 1-1 we thought we could get something from the game but it wasn't to be.
"I have no problem with the effort and desire we showed and you have to give credit to the opposition."
Colchester: Gerken, Duguid, Baldwin, Brown, Barker, Garcia, Watson, Izzet, Jackson (Ephraim 35), Iwelumo (Guy 76), Cureton.
Subs Not Used: Davison, White, McLeod.
Booked: Cureton, Duguid.
Goals: Brown 45, Garcia 82, Cureton 89 pen.
Sunderland: Ward, Whitehead, Evans, Nosworthy, Collins, Edwards, Leadbitter (Elliott 85), Yorke, Murphy (Stokes 73), John (Wallace 60), Connolly.
Subs Not Used: Fulop, Liam Miller.
Booked: Murphy, Yorke.
Goals: Yorke 55.
Att: 6,042.
Ref: L Probert (Gloucestershire).