However, Inverness Caledonian Thistle and Greenock Morton were knocked out despite winning and finishing second in their groups.
Inverness beat Forfar 2-1 and Morton were 5-0 winners over Edinburgh City.
Elsewhere, St Mirren beat Airdrieonians 5-0, Falkirk defeated Brechin City 3-0, Motherwell edged Berwick Rangers 1-0 and Raith Rovers beat Cowdenbeath 2-0.
Falkirk, Motherwell and Thistle's group rivals Livingston had already secured second-round places as group winners while St Mirren, Airdrie, Brechin, Berwick, Raith and Cowden were unable to go through before playing their final group games.
In Group H, Premiership Partick Thistle were kept out by League One Stranraer until the 87th minute when Elliott struck from inside the box.
Thistle had beaten St Mirren 5-0 last Saturday and the Buddies recovered from that loss by putting five goals past Airdrieonians in Paisley.
Former Aberdeen striker Cammy Smith and ex-Hearts forward Gavin Reilly each scored twice for Jack Ross' side and Lewis Morgan got their fifth.
In Group A, top side Falkirk went ahead through Lee Miller's strike with Joe McKee and Alex Harris also on target against Brechin City.
Inverness CT went behind against Forfar Athletic when Marc Scott shot home but strikes in quick succession by George Oakley and John Baird turned the match in the Highlanders' favour.
In Group F, Motherwell had to wait until the 82nd minute to get in front of visitors Berwick Rangers, Elliott Frear netting after goalkeeper Robby McCrorie palmed out Chris Cadden's cross.
And at Cappielow, Bob McHugh and Robert Thomson got two each and Jai Quitongo also netted for Greenock Morton against Edinburgh City.
In Group C, Raith Rovers scored twice in the first half against Cowdenbeath, Lewis Vaughan and Liam Buchanan on target.
Partick Thistle beat Stranraer to progress in the League Cup as one of the best first-round group runners-up.