The forward struck in the opening minutes of the game to give the U's victory.
Liam Kelly had the ball in the goal deep into additional time but the linesman's flag prevented the goal from counting and Latics just stay in the Sky Bet League One play-off places after Chesterfield's late defeat.
Latics got off to the worst possible start, falling behind in the opening two minutes of the game.
The home side failed to clear a David Fox corner into the box and Szmodics put the ball beyond Jake Kean to open the scoring for the U's.
Latics were shocked by the start and struggled to create an opening in a stubborn Colchester defence.
The visitors looked dangerous on the break but the supporters were doing their best to get behind the club off the field.
The home side were probing the U's but the ball would not fall for a Latics player inside the box.
On the half an hour mark, Colchester's Gavin Massey let fly from 25 yards but Kean was behind the ball and saved well.
The visitors again went close two minutes later as goalscorer Szmodics ghosted behind Liam Kelly but he shot wide.
George Elokobi was booked eight minutes before the break after he fouled Tom Lapslie inside the centre circle.
Latics attacked more towards the end of the half but could not force U's goalkeeper Sam Walker into a save.
Manager Lee Johnson must have had a go at his players at half time as Latics came out flying in the second half.
Mike Jones had a perfect opportunity to equalise two minutes into the second half but struck wide.
Jonathan Forte held the ball up well, crossed for Rhys Murphy. U's goalkeeper Sam Walker could only punch into the path of Jones but he smashed past the post.
Kean was alert at the other end as Massey nipped inside of Brian Wilson but the goalkeeper saved well with his feet.
Latics were turning the screw and had their best opportunity of the game ten minutes into the second half.
Jacob Mellis received the ball on the edge of the area, curled goalwards but Walker tipped the ball around the post.
Athletic made a triple change to get back into the game with Carl Winchester, Rhys Turner and Dominic Poleon entering the field.
They made an instant impact as Latics upped their urgency but the U's defence stood resolutely.
Just after the hour mark, leading goalscorer Forte raced through one-on-one with Walker but he could not nick the ball past the goalkeeper and the chance was lost.
The visitors did their best to slow the game down and frustrated the home supporters.
Latics entered the final ten minutes of the game throwing everything forward in a bid to get a result from the game.
Kelly was denied by the hands of Walker but Colchester broke and Kean pulled off a wonderful save to deny Massey.
Substitute Poleon was the next to go close as his curled effort towards the top corner went just wide of the post.
Latics continued to press and Elokobi joined the attack to add height and strength up top.
Deep into the three minutes of additional time, Latics thought they had equalised through Kelly's late strike but the linesman's flag denied the home side a point.
Oldham Athletic: Kean, B.Wilson, J.Wilson, Elokobi, Mills, Kelly, Jones (Poleon 57'), Mellis (Winchester 57'), Forte, Philliskirk, Murphy (Turner 57').
Subs not used: Coleman, Brown, Dieng, Kusunga.
Colchester United: Walker, Clohessy, Wynter, Eastman, Briggs, Fox, Lapsile, Hewitt (Bonne 89'), Szmodics (Marriott 83'), Massey, Porter.
Subs not used: Lewington, Gordon, McEvoy, Sembie-Ferris, Harney.
Goals: Oldham Athletic 0-1 Colchester Untied (Szmodics 2')
Attendance: 5,668 (74 visiting supporters)