Dwarfs took the lead when Stephen Bentil headed home from a Moro Adams corner but Hearts took little time to find the equalizer courtesy of former Dwarfs defender Christopher Bonney.
Dwarfs restored their lead in the 63rd minute but substitute Richard Zuma netted a fantastic double to secure victory for Hearts of Oak.
Elsewhere, Asante Kotoko secured a hard-fought 2-0 victory over Aduana Stars at the Baba Yara Stadium to qualify for the semi-finals.
Two long-range efforts in either half from Eric Donkor and Kwame Boahen ensured Kotoko sailed through as winners of group A.
Other results include Medeama 0-0 Karela United and Dreams FC 1-0 Eleven Wonders.