Lens will face Monaco in the last 16 of the French Cup after Lille's Renato Sanches missed the crucial penalty when their game ended 1-1 after 90 minutes.
Lens to host Monaco in French Cup last 16 after Sanches spot-kick miss
Lens' Seko Fofana celebrates his 95th minute equaliser
Cup holders Paris Saint-Germain will host Nice in the next round, scheduled for the end of this month, while record 10-time winners Saint-Etienne will head to fourth-tier Bergerac, after the draw was made earlier on Tuesday.
Lens captain Seko Fofana scored twice after his outfit trailed 2-0 in the first half and converted the winning penalty.
"We're very happy, there's a lot of pride tonight," he told Eurosport.
"At the start we found it hard to find each other on the field. We made some small errors.
"A game lasts 90 minutes, we put a big effort in and we were rewarded for that," he added.
In front of just 5,000 fans at the 38,000-capacity Stade Bollaert-Delelis due to coronavirus restrictions, the visiting Ligue 1 champions Lille dominated the first half of the northern derby against Lens.
Lille's Amadou Onana opened the scoring after 28 minutes, heading home when Tiago Djalo's cross was deflected to the midfielder by Kevin Danso.
Onana, 20, a Belgium under-21 international, then claimed the maiden double of his senior career on the counter attack.
Turkey's Yusuf Yazici broke down the left before feeding Jonathan Bamba who set-up Dakar-born Onana to make it 2-0 after 33 minutes.
Lille's advantage was halved when skipper Fofana claimed his sixth goal of the campaign following Arnaud Kalimuendo's side-footed pass to the delight of the minimal home crowd.
With six minutes left, Yazici almost made sure of his side's place in the last 16, but his low effort rebounded off the bottom of the post.
With 15 seconds left of normal time Lens were inches from a second goal but replacement Ibrahima Balde's shot fired off the crossbar.
Fofana then did one better than Balde as he beat Lille goalkeeper Ivo Grbic after 95 minutes with a low shot to send the tie into penalties.
The hosts then clinched their place in the next round after winning 4-3 on spot kicks as Wuilker Farinez saved Portugal midfielder Sanches' effort and Fofana converted his penalty.
French Cup last 16 draw (matches to be played on weekend of January 28-31):
Marseille v Montpellier
Paris Saint-Germain v Nice
Nantes v Brest
Lens v Monaco
Nancy v Amiens
Reims v SC Bastia
Versailles v Toulouse
Bergerac v Saint-Etienne