Haraguchi ends Hertha's 35-year wait to reach cup semis
The hosts took an early lead when defender Arne Feick was left unmarked from a free-kick to head home on 10 minutes.
But Hertha's Vedad Ibisevic netted twice to put Berlin 2-1 up after 21 minutes as heavy snow fell in southern Germany.
Haraguchi scored what proved to be the winner when he beat two defenders on a mazy dribble before beating the goalkeeper on 58 minutes.
There was a nervous final few minutes as Heidenheim pulled a goal back when Marc Schnatterer netted a late penalty.
Hertha are now just one game away from a home cup final at Berlin's Olympic Stadium on May 21.
The last time Hertha was in the last four was in 1985, almost a decade before winger Mitchell Weiser, who set up both of Ibisevic's goals, was born.
"We got off to a bad start, but we ended up dominating. Now we want to reach the final," said right-back Weiser.
Later, Pep Guardiola's Bayern Munich will attempt to join Borussia Dortmund, Werder Bremen and Hertha Berlin in the last four when they play VfL Bochum.
On Tuesday, Pierre-Emerick Aubameyang claimed his 30th goal of the season as Dortmund won 3-1 at VfB Stuttgart.
Gabon striker Aubameyang and Germany winger Marco Reus, who have provided 45 of Dortmund's goals in all competitions this season, netted before Henrik Mkhitaryan claimed their late third.
And veteran Claudio Pizarro helped seal Werder Bremen's 3-1 win at ten-man Bayer Leverkusen by playing a key role in their shock victory.
There was a strong Latin American flavour at Leverkusen's BayArena as Bremen booked their place in April's semi-finals.
Mexico's Javier Hernandez put Leverkusen ahead, then Bremen's Argentinian centre-back Santiago Garcia levelled before Brazilian defender Wendell was sent off for Bayer just before the half-time break.
After Wendall's dismissal, Peru's 37-year-old striker Pizarro scored Bremen's second by converting the resulting penalty, then set up their third.
Leverkusen took the lead when ex-Manchester United forward Hernandez continued his record of scoring in each round of the cup.
It was his 22nd goal for Bayer this season in all competitions on 22 minutes before limping off with a torn buttock muscle.
The lead lasted nine minutes as Bremen's Argentinian centre-back Santiago Garcia put Werder level by hitting the bottom left-hand corner of Leverkusen's net to make it 1-1.
Disaster struck for the hosts when Wendell was shown a straight red for hauling down Bartels, who was through on goal, just before the break
The 37-year-old Pizarro, who last weekend became the first foreign player to make 400 Bundesliga appearances, hit his eighth goal of the season.
Pizarro then played a big part in Bremen's third as his shot was saved by Leverkusen goalkeeper Bernd Leno, but Florian Grillitsch tapped home the rebound on 82 minutes.