Michael Stewart was sent off after just 20 minutes and team-mate Laryea Kingston scored at both ends in a lively encounter.
In addition to the sending-off, nine players were yellow-carded as the game boiled over at times.
Hearts took control of the early stages and almost scored after four minutes when Greg Fleming made a good stop from Marius Zaliukas, before Christian Nade saw his follow-up shot blocked by Chris Innes.
Gretna responded and Paul Murray flicked a shot wide after a cross from Ryan McGuffie.
Hearts were reduced to ten men after 20 minutes when Stewart lashed out at Danny Grainger and referee Michael Tumilty decided it was worthy of a red card.
But the sending-off seemed to fire Hearts up and they took the lead six minutes later with a well-worked goal.
Andrew Driver made the running to create an opening for Kingston and the midfield player kept his composure before firing a shot beyond the reach of Fleming.
Gretna tried to hit back but were wasteful with the set-pieces that came their way and Hearts were comfortable enough at the back.
Fabian Yantorno had their first effort on target ten minutes from the break but Anthony Basso easily clutched his header.
Hearts always looked the more likely in front of goal and, shortly before the break, Christophe Berra was inches away from connecting with a flick from Zaliukas in front of goal.
But Gretna came closer in injury-time when James Grady just failed to touch in a header from McGuffie with the Hearts defence in disarray.
The bottom side opened the second half strongly and Basso produced an acrobatic save to keep out a fine effort from Yantorno.
From the resultant corner, Evan Horwood's cross struck Kingston and bounced into the net for the equaliser.
The goal gave Gretna encouragement and Hearts started to look vulnerable at the back.
But Eggert Jonsson gave the Edinburgh side some hope with a tremendous shot which beat Fleming but was deflected inches wide.
The game erupted in 64 minutes when Audrius Ksanavicius pushed Yantorno to the ground and several players reacted angrily.
The Lithuanian was fortunate just to be shown the yellow card and team-mate Zaliukas and Gretna's Grady were also booked in the aftermath.
Basso saved well from Yantorno as Gretna threatened again, as they saw the chance of a rare win.
Substitute Andrius Velicka volleyed narrowly over and Driver also shot wide in the closing stages as Hearts pressed.