Nervy last 30 minutes, but Bluebirds secure the points.
Cardiff City resisted a strong revival from lowly Barnsley to cut Wolves’ lead at the top of the Championship to three points.
Callum Paterson’s rebound and Marko Grujic’s fine 20-yard strike gave the hosts a comfortable 2-0 advantage.
But a goal from Oli McBurnie, on loan from Swansea, swung the momentum in Barnsley’s favour.
The visitors pressed for an equaliser but Cardiff held on for a fifth straight win.
Barnsley stay 21st in the Championship table, two points above the relegation zone, while second-placed Cardiff continue to breathe down the necks of the division’s pace-setters.
It was not long ago that Wolves seemed to be riding off into the sunset, 13 points clear at the summit last month and seemingly destined to win the Championship at a canter.
They remain strong favourites to be crowned champions but, with Cardiff winning their previous four games, the Bluebirds had narrowed the deficit between themselves and the erstwhile runaway leaders to six points before this encounter.
A resolute defence had been the foundation for their eight-match unbeaten run in the Championship, with a clean sheet in each of their four successive victories.
McBurnie’s goal, which the Swansea loanee celebrated gleefully after being taunted relentlessly by Cardiff’s fans, was the first conceded by the home defence in almost eight hours of football – but it proved academic.
Cardiff started purposefully and, after Kenneth Zohore missed a chance, Paterson – who scored the winner against Barnsley in November’s reverse fixture – was on hand to fire firmly into the bottom corner.
Zohore had already created chances for Craig Bryson and Kadeem Harris and, although those were spurned, the Bluebirds were 2-0 up early in the second half as Grujic was given time and space outside Barnsley’s penalty area to pick his spot and elegantly curl in his first goal for the club since joining on loan from Liverpool.
The home side appeared in total control but their failure to clear a cross by Andy Yiadom gave McBurnie the opportunity to bring the ball down inside the box and finish smartly for his fourth goal in three games.
That transformed the mood inside Cardiff City Stadium, with the hosts anxious and unable to keep possession as they invited pressure from their increasingly confident opponents.
Barnsley’s Bradley Potts saw a low effort well saved by Neil Etheridge, who was then clattered by the onrushing Kieffer Moore, who was booked for his lunge.
Cardiff missed chances to kill off the game in added time when first Bryson fired wide and then substitute Nathaniel Mendez-Laing curled his shot against the post, but it mattered little as Warnock’s side dug in for yet another spirited victory which further strengthens their promotion credentials.
Cardiff City manager Neil Warnock:
“I said the last 20 minutes would define our season because they had their tails up and we were all at sea.
“I have a great bunch of lads. I can’t fault the effort. But people can’t ever accuse our team of being physical after what we have seen.
“I was more disappointed at some of the things (that were) allowed to happen but it’s another three points and we move on. It’s a disgrace, how Kieffer Moore has not been sent off for two challenges I do not know. So, I’m extra pleased that we have stood up to that.
“We missed some easy chances that my wife could have put in.”
Barnsley boss Jose Morais:
“We were unlucky with the way things went. We had a penalty which wasn’t given, we scored a goal and then had other opportunities but we couldn’t score again.
“The opponent is second in the league and are a candidate to be in the Premier League next season and if we had started better, I believe we could have got more than we did.
“I am positive and I can be proud of how the players played the game and the attitude they had, especially in the second-half. I have a very positive outlook for the future.”
Halford 6.5 (for Grujic 56 mins)
Damour 6.5 (for Paterson 62 mins)
Mendez-Laing 7 (for Harris 70 mins)