United left it late to grab a point but a clinical finish from Charlie Wyke deep into time added on was enough to keep Cumbrian heads above water in their fight against relegation.
It was a dream start for United when a deep free kick, with just two minutes on the clock, fell to Potts on the edge of the box. His initial shot was blocked but it sat up nicely for Dempsey and he bided his time before drilling his ninth of the season under the keeper and into the back of the net from 22 yards.
The Cumbrians almost doubled their lead moments later when Rigg pulled wide and clipped a lovely ball into the area. Potts challenged and Wyke was able to spin as it ran down off his chest. His shot hit Butler and Passley was able to step over to clear.
A cross from Grainger caused problems as United stayed forward, and Corry and Kennedy rushed in to put the Pompey back line under pressure. It broke free for a fleeting moment but the yellow shirts recovered to protect their goal.
Portsmouth started to get into the game and they went close midway through the half when Atangana watched a cross from the left. His volley from 17 yards was cleanly struck and it shaved the top of the bar as Hanford went full stretch.
Carlisle responded with a flowing attack which put Brough clear on the left flank. His cross eventually came to Wyke and his lay off brought a toe poke from Dempsey which spun away to safety off the shin of the defender.
More good work from the visitors put Passley clear and he used the space to pick Atangana out in the box. He rose well to meet it but he couldn't keep it down and his header dropped harmlessly over the target.
Portsmouth enjoyed a good spell and a direct run from Butler brought a near post cross for Fogden to challenge for. He got there first but he couldn't find a way through.
The Pompey equaliser came from a moment of skill from the prolific Jed Wallace as he cut into acres of space from the left flank. He stunned everyone when he let fly from 28 yards and sent a fantastic shot into the roof of the net.
Wallace was given another sight of goal on the stroke of half time when a long throw was only half cleared. He took a touch but it was a difficult moment and it flew high over the crossbar.
Carlisle wasted a fantastic opportunity to take a lead into the half time break when a high cross was superbly controlled by Corry. His chest down, dead central and 18 yards out, was perfect for the volley, but he went for accuracy rather than power and succeeded only in guiding it past the upright.
United were made to pay for the miss when they failed to deal with a lightning quick move from a throw-in which left them light at the back. Taylor streaked away and his low cross was prodded in at the far post by a jubilant Matt Tubbs.
The teams exchanged crosses through a busy start to the second period and the first effort of the half came when an O'Hanlon clearance was picked off in midfield. Three passes released Wallace and Hanford had to go high and full stretch to tip his top corner bound effort over the bar.
Dempsey toe poked one wide at the other end as United worked hard to get their attacking game going, but Brough had to be careful as he backtracked to clear a cross from Wallace. He got it over his bar as Tubbs slid in to make a connection.
Potts dragged one wide as Carlisle attacked sporadically but Portsmouth had one from Taylor ruled out for offside as he slipped a parry from a Dunne shot into the back of the net.
United raised hopes as Wyke nodded wide from 12 yards with ten minutes left to play, and Potts was a yard over when he flashed a decent effort from distance an inch over. But Pompey were still a threat, as demonstrated by Taylor when he thumped a powerful header over the bar from close range.
Grainger sent a late free kick into the wall and Portsmouth sat deep top protect their points, but they were undone with five added minutes on the clock when Kennedy battled for a high ball on the edge of the box. It eventually squirmed out to Wyke and he blazed his sixth of the campaign into the bottom corner to send the home fans wild.
United - Dempsey (2), Wyke (90+5)
Portsmouth - Wallace (38), Tubbs (45)
Carlisle United - Hanford, Atkinson, O'Hanlon, Grainger, Brough, Potts, Kennedy, Corry (Paynter 64), Dempsey (Dicker 78), Wyke, Rigg (Asamoah 77). Subs - Gillespie, Buddle, Beck, Young.
Portsmouth - Jones, Devera, Chorley (Nosworthy 46, Webster 54)), Wallace, Taylor, Tubbs (Hollands 84), Passley, Fogden, Dunne, Atangana, Butler. Subs - Westcarr, Cornell, Close, Chaplin.
Referee - Mr Nigel Miller
Attendance - 5,230 (789 away fans)