Cotterill's 10th goal of the season was one of his best, breaking the deadlock six minutes from time with a mazy run and curling finish to send Rovers second in the table.
It was rough luck on Colchester, who crashed to their eighth successive defeat despite looking the better side for large parts of the game.
Andy Williams scored a goal in each half as Swindon consolidated their grip on fifth place with a 4-0 home win over Carlisle.
Williams opened the scoring after 16 minutes and James Collins made it 2-0 20 minutes later.
Williams got his second 10 minutes into the second half before Raffaele de Vita completed the scoring 10 minutes for the end as Carlisle dropped one place to 18th.
Second-half goals from Lucas Akins and Marcus Haber saw Stevenage return to winning ways with a 2-1 victory and inflict Crewe's first home league defeat since October.
Chuks Aneke fired Alex ahead but two goals in five second-half minutes from the visitors ended their three-game losing streak.
Shrewsbury fought a rearguard battle to stretch their unbeaten run to seven games in a dour 0-0 draw at Scunthorpe.
The visitors failed to muster an effort on target for 80 minutes until substitute Tom Bradshaw finally tested goalkeeper Sam Slocombe from long range.
Despite dominating most of the possession, struggling Scunthorpe could not make it count, leaving them still with only one home win all season.