It had looked like Forest would lose at home for the first time since September 2009 when Nwankwo Kanu scored his first goal for 10 months to give Portsmouth a 26th-minute lead on Saturday.
But Forest's pressure eventually told and Ibrahima Sonko's 87th-minute own goal got them level before Marcus Tudgay netted the winner in the fourth and final minute of injury time.
Tudgay and Radoslaw Majewski came back into the Forest team as boss Billy Davies made two changes.
Tudgay was cup-tied at Preston last weekend but returned to partner Robert Earnshaw up front as David McGoldrick dropped down to the bench.
Majewski was recalled at the expense of leading scorer Lewis McGugan, who was also among the substitutes.
On-loan Manchester United defender Ritchie De Laet made his Portsmouth debut. The Belgium international took over at right-back, with Joel Ward stepping up into midfield due to Dave Kitson's suspension for his red card in the FA Cup defeat at Brighton.
There was little to get excited about until Kanu scored.
Hayden Mullins' speculative shot from 30 yards went wide after 17 minutes before Paul Anderson had an effort from a similar distance five minutes later that produced a routine save from Jamie Ashdown.
Kanu netted after David Nugent had dispossessed Forest right-back Chris Gunter.
Nugent slipped a pass to his strike partner and Kanu coolly went round keeper Lee Camp and scored.
It was the Nigerian's first goal since bagging a last-minute winner against Hull at Fratton Park in the Barclays Premier League on March 20.
Portsmouth almost built on Kanu's calm finish when Camp had to parry Liam Lawrence's shot from just outside the area in the 34th minute.
Tudgay had a sight of goal just before half-time but he volleyed over the crossbar from 12 yards out.
Much like the first half, Forest dominated possession but failed to create chances after the break and Davies introduced Tyson and McGugan after 57 minutes. Majewski and Earnshaw were the players to make way.
They made an impact. Tyson hit the crossbar with a long-range effort in the 66th minute and McGugan curled a free-kick just wide.
McGugan also forced Ashdown to tip a shot round a post in the 72nd minute before Tyson headed wide from Gunter's cross with five minutes remaining.
Forest eventually made the breakthrough when Sonko's attempted clearance flew into the top corner.
Davies's side kept pressing and they snatched victory right at the death when Tudgay converted McGugan's right-wing cross from two yards out.