An own goal from Gillingham player-boss Andy Hessenthaler gave Walsall their second successive win.
Spanish midfielder Pedro Matias put the home side in front on 35 minutes when he finished off a superb four-man move.
Wayne Brown then equalised from the spot three minutes into the second half after Vinny Samways had handled inside the area.
But Hessenthaler put through is own net with six minutes remaining to give the Saddlers back-to-back wins following Saturday's triumph over Preston.
Walsall included loan men Chris Baird and Gary O'Neil in their starting line-up.
And both players had a hand in the winning goal.
O'Neil's corner to the far post was headed clear to Baird, whose mistimed volley was deflected in by the outstretched leg of Hessenthaler.
Walsall's opener was far classier affair.
Paul Merson and Samways combined to play the ball to Jamie Lawrence on the edge of the box - and his lay-off fell perfectly for Matias to rifle home just inside the right-hand post.
The Gills levelled when Samways was adjudged to have handled David Perpetuini's cross after the break.
Brown buried a sweetly-struck penalty beyond James Walker's outstretched dive.
But Walker had the last laugh, producing a fantastic full-length stop to keep out Tommy Johnson's effort in the dying seconds.
Walsall: Walker, Baird, Emblen, Ritchie, Aranalde, O'Neil, Lawrence, Samways, Matias, Merson, Leitao. Subs: Kerr, Bazeley, Osborn, Birch, Burton.
Gillingham: Bossu, Wayne Brown, Hope, Cox, Nosworthy, Perpetuini, Saunders, Smith, Spiller, Benjamin, Sidibe. Subs: Hills, Ashby, Hessenthaler, Tommy Johnson, Leon Johnson.
Referee: F Stretton (Nottinghamshire).