El Mabrouk hit a three-pointer with four seconds remaining in the extra session to send Tunisia into the Quarter-Finals where they will face Mali on Thursday.
The 1.89m guard came off the bench to contribute 8 crucial points for the Tunisians who struggled to preserve a 31-23 half-time lead.
Mejri, who came off the bench, finished with 8 points, 6 rebounds and 3 blocks as Tunisia avoided the biggest upset of the tournament.
The win saw Tunisia stay undefeated in four games, while Morocco remain winless in as many contests, despite displaying tremendous grit in their attempt to move forward in the competition.
Morocco missed successive free-throws in the critical moments of the game and paid the price for it.
They led 67-66 with 32 seconds to go in the overtime, but Mustafa Khalfi made only one of his two attempts from the foul line and El Mabrouk sealed the deal for the host nation with a three-pointer that sent the sellout Salle Omnisport de Rade into frenzy.
Morocco will next play play in the Classification Games.
Turning Point: Mejri's block on Zouita in the dying seconds of overtime saved Tunisia from elimination.
Stats Don't Lie: Morocco missed 7 of their 14 free throws.
Game Hero: El Mabrouk's three-pointer was a real dagger that will be extremely painful for Morocco.
The Bottom Line: Judging by Morocco's competitiveness in the Group Phase, it wasn't a surprise to see them giving Tunisia such a tough game. Meanwhile, it became clear that the hosts don't play at same level with Mejri on the sidelines.