Gambia ended the game being leapfrogged for top spot in Group F by Mali on goal difference, which beat Mauritania 2-0, and it will play Guinea in the round of 16, while third placed Tunisia will face Nigeria.
A relatively uneventful game in the main saw plenty of chances but few of note, with Tunisia's Ali Abdi going closest in the early stages as he cut inside from the left and saw his deflected shot fly just wide of the near post.
Ellyes Skhiri fired wide of the far stick with a well-hit effort on 41 minutes but shortly after Tunisia had a penalty when Seifeddine Jaziri was tripped by Pa Modou. Tunisia had missed their first two spot kicks of this tournament, which became three when Jaziri saw his penalty saved well down to his right by Baboucarr Gaye.
When the half-time whistle came, ill-tempered reactions by both teams as they headed off the pitch led to referee Fernando Guerrero Ramirez producing a red card to Tunisia's substitute goalkeeper Farouk Ben Mustapha.
Gambia showed a bit more intent in the second half with Jallow firing wide before Musa Barrow hit the woodwork with a fierce free-kick, but it took until the closing seconds of stoppage time for the deadlock to be broken as Jallow took down a cross from the left and fired the ball hard and high past Bechir Ben Said to win it for the Scorpions.