The visitors started the brighter with James Kaloczi forcing Lewis Ward into a smart save from a header within three minutes.
Jake Robinson was next to trouble Ward, who tipped his effort from the edge of the box wide.
More chances came Robinson’s way and he should have done better as he spun in behind only to sky his shot well over the bar. He then headed another chance wide of the target from 10 yards, when left in space.
Four minutes into the second half, his team claimed the opener though, as James Potton twisted in the left side of the box before curling the ball into the far corner.
Moments later Buchanan was close to equalising, when he worked a yard of space but saw his shot slam back off the far upright.
After seeing another effort deflected wide, the Margate striker, grabbed the leveller when he was superbly fed by Alex Osborn, rounding Jamie Butler to slot into an open net.
The visitors missed a golden chance to retake the lead when substitute Lewis Taafe crept in down Margate’s right side but he fizzed a shot narrowly over the bar.
Akindayini was inches away from grabbing the lead when he volleyed Matt Johnson’s header over the bar, only to make amends seconds later. The striker cut in from the right wing and bent a shot low into the far corner, leaving Butler rooted to the spot and sending the home fans delirious.
It could have been even better in injury time as Osborn flashed his volley from the edge of the box just wide of the post.
It wasn’t to matter though as the Blues secured their fifth win of the season, leapfrogging their opponents in the process.
Margate: Ward, Sessegnon, Tumwa, Johnson, Fitzsimons, Parry, Moore, Cash (Phipps 85), Buchanan, Akindayini (Mambo 90+4), Osborn. Subs not used: Bull
Hemel Hempstead: Butler, Connolly, Kelly (Corcoran 77), Parkes (Montgomery 68), Diagne, Hayden, Kaloczi, Saunders, Robinson, Potton, King (Taaffe 45). Subs not used: McNamara, Weiss.