Swindon took the lead through Lee Peacock’s sixth goal of the season after he was set up by a cross from Anthony McNamee.
Cox netted in the 53rd minute after he was set up by McNamee 15 yards from goal, the striker making no mistake as he lashed the ball home for his 11th goal of the campaign.
Cox added a second 20 minutes from time with a superb 25-yard shot when he linked up with Peacock before turning and rifling home.
Chris Taylor wasted Oldham’s best chance in the first-half with a disappointing effort after he had been picked out by Neal Eardley, but sent his shot wide.
The result leaves Oldham’s play-off hopes hanging by a thread as the games start to run out for them to grab a spot in the top six.