Craig Noone had to clear a Chris Burke shot off the line early on as Forest had the better of the early chances, but the block launched a counter-attack for the hosts, resulting in Federico Macheda firing the ball into the bottom corner.
Cardiff needed just five minutes to double their lead after Peter Whittingham picked the ball up 25 yards out, and had enough time and space to blast in a second.
The visitors started to see more of the ball as the second half progressed, resulting in Britt Assombalonga finding the back of the net, but his four-match goal drought continued as the effort was ruled out for offside.
Forest had a string of corners with just over 10 minutes to go, but Michael Antonio's deliveries continued to miss his teammates.
The visitors continued to push and did manage to pull one back inside the final minutes as Assombalonga swept the ball in from an Antonio cross.
Marshall had to remain alert in stoppage time as Antonio tried to fire home an equaliser, but the Scottish international held on to secure the win for Cardiff.