The hosts took a 31st-minute lead when Adam Nagy broke from midfield and fed Nahki Wells, who struck a low right-footed shot past Simon Sluga from inside the box.
Nagy made it 2-0 on 38 minutes, firing in from a narrow angle after Sluga had palmed aside a Wells header.
Luton hit back on 49 minutes, Collins netting with a near-post header from Kiernan Dewsbury-Hall's corner.
Nine minutes later Elijah Adebayo equalised with a clever first time shot from 12 yards and on 74 minutes Cornick completed a remarkable turnaround firing home the winner with a left-footed finish from inside the box.
The result left City without a home win since January and a victory of any sort in eight games.
Striker Famara Diedhiou was missing from the Robins' line-up with a knee problem, which meant a first start for 18-year-old Academy product Tommy Conway.
Luton boss Nathan Jones named an unchanged team and saw his team make a bright start.
Adebayo sent a shot from a narrow angle just over and, from a disputed corner, the ball ended up in the net, only for referee John Busby to blow up for a free kick.
City looked bright going forward, but took 19 minutes to register a shot. Then Wells' low effort from 25 yards passed harmlessly wide.
Three minutes later Wells ran onto a chipped ball behind the Luton defence, but goalkeeper Sluga advanced to save.
A Jordan Clark shot for Luton flashed across goal wide of the far post, but soon afterwards the Hatters found themselves behind as Wells made the most of Nagy's pass to finish smartly.
Wells had another chance, which he totally mishit from a Tommy Rowe cross, before Nagy doubled City's advantage.
Dan Bentley did well to protect the lead with a reaction save from a Clark header, but Luton had nothing to show for their first-half efforts.
Jones reacted by sending on Collins and Cornick for Ryan Tunnicliffe and Kazenga Lua Lua at the start of the second half.
The changes almost paid dividends straight away as Collins had a header blocked by Zak Vyner and City managed to clear the resulting goalmouth scramble.
Conway was showing up well for the home side and had a low shot from a narrow angle tipped wide by Sluga on 58 minutes.
But Collins would not be denied and his goal gave Luton renewed hope.
Adebayo's clever finish levelled the scores and City boss Nigel Pearson responded with a quadruple substitution on 71 minutes.
But Luton had the momentum now and Cornick's strike after a Dewsbury-Hall shot had been blocked sealed their fightback.
Conway had the ball in the net for City late on but was denied by a flag for offside.