The 19-year-old Swedish midfielder netted the winner with a late header after Unai Nuñez and Jorgen Strand Larsen gave Celta a 2-0 lead before half-time.
Rafa Benítez's Celta entered the fourth round coming off two losses and a draw.
Almeria remained winless and picked up their third loss in four matches. They stayed second-to-last and in danger of dropping to the bottom of the standings at the weekend.
It was the third loss in four matches for Villarreal, who played a man down from the 22nd minute because Alfonso Pedraza was sent off.
Villarreal coach Quique Setién was also sent off, and Sorloth had to be replaced because of an injury in the 27th.