The 26-year-old striker came off the bench to net a late winner after fellow substitute Craig Noone had cancelled out Papiss Cisse's opener, handing the Norwegian boss a maiden win
The Magpies twice hit the woodwork through Hatem Ben Arfa before finally breaking the deadlock on the hour mark, with Papiss Cisse latching onto a loose ball inside the box and tucking the ball beyond David Marshall.
But the away team responded with two quick-fire goals. First, Craig Noone sent a fizzing long-range effort into the back of the net, before fellow substitute Frazier Campbell completed the turnaround by converting Peter Whittingham's corner moments later.
Newcastle was without the suspended Mathieu Debuchy, while Cisse started in attack in a side captained by Cheick Tiote in the absence of Fabricio Coloccini.
Solskjaer, meanwhile, made five changes to Cardiff's starting XI from the 2-0 Premier League defeat to Arsenal, with Andreas Cornelius and Peter Odemwingie paired up front for the visitors.
Cardiff made the better start to proceedings and looked to have taken the lead when Mark Hudson headed home Whittingham's corner after nine minutes, only for the goal to be ruled out for a push in the area.
The hosts finally threatened when Hatem Ben Arfa crashed an effort against the left-hand post after 24 minutes.
Yoan Gouffran then shot wide on the half-hour mark, but Newcastle generally struggled to test the Cardiff goalkeeper.
Marshall was called into action twice in the early stages of the second half as he denied both Ben Arfa and Moussa Sissoko.
But Newcastle was rewarded for its positive second-half showing in the 61st minute, Cisse converting from point-blank range for only his third goal of the season after Sissoko's initial shot had been only partially cleared.
Cardiff's response was a strong one and Solskjaer's men came close to leveling when Campbell struck the post with an effort from 18 yards.
It was Noone's introduction that would prove pivotal, though, with the midfielder's driving run and long-range piledriver flying past Rob Elliot and into the top corner.
The tie appeared poised for a replay at that point, but, with both sides pushing for a winner late on, it was the Welsh side which ultimately got it - as with 10 minutes left Campbell rose highest to head Cardiff into the fourth round.