Barcelona held a 10-point lead over Atletico in early November, but a poor run of form, and a string of wins for Diego Simeone's side, have seen Atletico overhaul their rivals.
Atletico arrived at the Estadi Olimpic Lluis level on points with their hosts, knowing a victory would see them enter 2025 as La Liga leaders.
They were second best for most of the evening evening and were forced to weather a storm of Barcelona attacks throughout.
Gavi should have headed the hosts ahead in the 25th minute when he found himself unmarked and on the end of a Raphinha cross, but failed to find the target from close range.
The Spain midfielder redeemed himself shortly after, though, as he set up Pedri's opener with a clever backheel.
With Flick serving the second of a two-game touchline ban and watching from the stands, Barcelona continued to surge in the second half.
Fermin Lopez was denied by a solid save from Oblak, and Pedri slammed an effort just over, while Raphinha rattled the crossbar with an audacious lob before missing when one-on-one with the goalkeeper.
But the hosts were left to rue their missed chances as De Paul sprinted on to Casado's failed backheel clearance and planted the ball in the bottom corner.
And Barcelona, who have now lost their last three league games at home, were stunned when Sorloth hit the late winner, and Atletico's celebrations continued when the final whistle blew.