The Bluebirds moved back into second place in the standings thanks to goals from Sean Morrison and Aron Gunnarsson, whose efforts were enough to nullify an equaliser from Liam Bridcutt at the City Stadium.
The visitors continued to appear the better of the two sides early on and they should have taken the lead when Lolley again burst forward to feed Bridcutt, but the midfielder's poor first touch allowed home stopper Neil Etheridge to rush off his line and gather.
It was Cardiff who were to grab the game's opener, though, as Morrison was left free in the area to rise highest and head a corner beyond Stefanos Kapino, who was being shrewdly blocked by a quick-thinking Gunnarsson.
City slowly grew into the contest and they should have doubled their lead after the interval when Kenneth Zohore broke clean through, only to see his chipped finish come back off the inside of the post with Kapino beaten.
Forest took full advantage of the miss as they found a route back into the game when Ben Osborn beat the challenge of Sol Bamba, allowing Bridcutt to meet his inch-perfect cross and send a finish beyond Etheridge.
Bamba soon made amends for missing the challenge, however, as the centre-back kept a free kick alive by heading the ball back into the danger zone from the back post, where Gunnarsson produced a deft finish to pick out the bottom corner and send Cardiff back into the lead.
Cardiff's nerves might have been spared late on too when Morrison went down under a suspect challenge from Jack Colback, although the referee waved play on despite protests from the City bench.
In the end Warnock's charges held on to claim three crucial points at home that will add more fuel to the club's race with Fulham to secure a top-two finish and automatic promotion into the Premier League.
CARDIFF CITY (4-3-3): Etheridge; Peltier (Bamba 46'), Morrison, Ecuele Manga, Bennett; Ralls, Gunnarsson, Bryson (Paterson 87'); Hoilett, Zohore, Mendez-Laing (Wildschut 71')
NOTTINGHAM FOREST (4-3-3): Kapino; Lichaj, Figueiredo (Mancienne 60'), Fox, Osborn; Watson, Colback, Bridcutt (Guedioura 71'); Cash, Brereton, Lolley (Vellios 81')