With just over a kilometre to go, Bennett couldn't cling on any longer, losing touch with the pace set by Egan Bernal's Team Sky teammate Ivan Sosa, and eventually finishing the stage 4.39 down on Martinez, and 1.06 behind Bernal and fellow contender Nairo Quintana.
However, most importantly, of the 12 riders who started the stage ahead of Bennett on the general classification, the New Zealand climber finished well ahead of eight of them, and as a result moved into a strong position with one stage remaining.
22-year-old Colombian wonderkid Bernal now leads the race by 45 seconds over Gilbert, with tomorrow's final stage in Nice being a short, punchy affair, featuring six categorised climbs.
Though the majority of the climbs are at moderate gradients, the stage lends itself to long-range attacks, with Marc Soler managing to overcome a 37 second deficit and jump from sixth to first with an attack from distance last year.
It will put riders like Gilbert – now in second overall - in trouble, and means that Bennett could well move within touching distance of a top five finish with another good showing, as he aims for one of the best results of his career.
Elsewhere, New Zealand's top young cycling prospect has shone at the Oceania Cycling Championships.
Finn Fisher-Black, an under 19 individual pursuit world record holder on the track, has claimed both the men's under-19 Oceania time trial and under-19 road race titles, doing the double in impressive fashion.
Sharlotte Lucas defended her women's road race title, while six other Kiwi riders took podium places in their respective age-group events.