The League One leaders were outplayed by a side with no win in 10 games but Barnes struck the decisive blow mid-way through the second half.
Brighton's Chris Wood went close early on but they needed goalkeeper Casper Ankergren to make a flying save after Dale Stephens hit a superb shot from 25 yards. Oldham were firmly on top and Filipe Morais drilled wide before strong penalty appeals were ignored after Brighton defender Marcos Painter appeared guilty of handball.
Ankergren saved well from Morais but Brighton were unlucky on the stroke of half-time when Glenn Murray headed against the bar.
Murray also fired wide before Brighton took a controversial lead in the 67th minute as the assistant referee failed to give offside and Barnes darted clear to slot inside the far post from 10 yards.
The goal-scoring sub was forced off with injury before Brighton went into their shell with Oldham pressing hard for an equaliser. Ankergren just about denied Cedric Evina and, deep into stoppage time, Kieran Lee shaved the woodwork from a tight angle.