Souda illuminated the first half with a dazzling display, opening the scoring with a fine low drive, striking the post and tormenting the Honest Men with tricks, flicks and direct running.
The French-Tunisian front-man faded in the second period – as did Livi, with Andy Murdoch restoring parity for the visitors seven minutes after the restart.
However, a last-gasp strike from the unlikely source of Lamie was enough to send the Almondvale outfit to the summit of Group G.
Livingston were the first to threaten when former Ayr favourite Nicky Devlin, making his debut following a summer switch from Walsall, produced a sensational cross for Souda, only for him to head against the woodwork before blasting the rebound over the bar.
However, Gary Holt's men would not be denied for long. Lawless found Souda with a magnificent crossfield pass, allowing the 26-year-old to cut in from the left-flank and despatch a clinical low shot beyond Ross Doohan.
Having been outplayed for much of the first period, Championship Ayr emerged after the break with renewed impetus and were level within seven minutes of the restart.
Michael Moffat was the creator as he hit the byline and produced a perfect cutback for Murdoch to scramble the ball over the line.
However, Livi claimed all three points at the other end when Scott Tiffoney scampered down the right and produced a deep cross which was coolly converted by Lamie.