George Baldock's injury-time piledriver gave the Dons all three points after Antony Kay's equaliser cancelled out the opening goal from Michael Smith.
The result saw the Milton Keynes club replace the Robins in seventh-place in the table, with Swindon having won just once in their last 10 games.
Cooper said: "We should have killed the game off at the start of the second half, but we didn't get the goal and that gave them encouragement.
"We concede from a free header from a corner so we try and win the game but left ourselves exposed.
"We're not quite there yet. We should have killed the game off but didn't have that killer instinct."