The Robins looked to be heading for victory when James Collins fired them in front after 83 minutes.
But Michael Collins triggered an amazing fightback when he scrambled home an equaliser from a corner four minutes later before Mark Duffy's penalty and a Karl Hawley strike - both in stoppage time - then secured a 3-1 win for the Iron, who were relegated despite their efforts.
"It was really disappointing to end our league season with a defeat like this," said MacDonald.
"For 90 of the 96 minutes we were the better team. We had enough chances to have won the game and we should have had it sewn up when we went in front so late on.
"Whether the pitch invasion that followed that goal had any bearing on what happened, I don't know. But our play became untidy and we lost concentration.
"We cannot afford to let that happen in the play-offs, we have to do better."