Dalkeith Thistle left it late with two injury time goals to add a sheen to this scoreline.
But in truth the Jags made heavy weather of the game, relying on a a controversial penalty from Ryan McQueenie and a goal from Connor Glenholmes.
It started well for them though with Paul Tansey’s deft lob on ten minutes however the goal prompted the Fife side and they came back into proceedings with end-to-end action.
Ward went close to an equaliser before Thistle saw Neil Janczyk’s free-kick beat the goalkeeper but smack the underside of the bar.
In the second half Shippy had the ball in the net but ruled out for offside. It was a warning not heeded by the Jags and 58 minutes they equalised when Shaun Murray gave away a freekick just outside the box.
Galloway found the back of the net with a shot which flew past McQueen.
Claims for a Dalkeith penalty were waved away on 70 minutes when Steven Scott was sent tumbling in the box. They got their penalty later when the game burst into life after the 90th minute.
Scott had the ball in the net after Janczyk’s through ball but the referee pulled play back for a penalty without allowing the goal.
The Shipyard keeper was shown a second yellow followed by a red, then Ryan McQueenie kept his head and then beat the substitute keeper after the melee had died down.
It was a harsh end to the match for the visitors and it got worse for them when with the last action of the match Connor Glenhomes cut into the box from the left and saw his shot deflected into the back of the net to seal the win.
Dalkeith: McQueen, Murray, Lister, McQueenie, Connell, Jancyzk, Wales, McGlashen, Hunter, Scott, Tansey
Subs: Easton, Smith, Muir, Grandison, McNeill, Glenholmes.