Leicestershire 253 and 75 for 3 require a further 249 to beat Glamorgan 278 and 298 (Ingram 60, Salter 54*, Raine 5-43)
Leicestershire medium-fast bowler Ben Raine ripped through Glamorgan's middle order to give Leicestershire hope of victory in the Division Two match in Cardiff.
Raine tore the hosts' middle order apart, taking four wickets for two runs in 17 deliveries after Colin Ingram, with a polished innings of 60, and opener Jacques Rudolph had put on 96 for third wicket.
Raine dismissed Ingram, Chris Cooke, Craig Meschede and Mark Wallace, the last two for ducks, in quick succession to leave Glamorgan rocking on 105 for 6.
It meant their lead was only 130, but yet again Graham Wagg, after his 200 and 94 in the last two innings, counter-attacked effectively and as the last three wickets piled up 139 with consummate ease it helped to rally Glamorgan to a second innings total of 298.
Visitors Leicestershire closed the penultimate day on 75 for 3 and will go in search of the 249 more runs they need for victory on Thursday's final day, while Glamorgan need seven more wickets to record their fourth successive championship win.
Glamorgan captain Jacques Rudolph top-scored for the hosts with 74 after remaining at the crease for five and a half hours while Raine claimed a career-best 5 wickets for 43 runs in the innings.
Rudolph was assisted by Ingram and latterly Wagg, with the tailenders chipping in at the end of the innings.
Rudolph eventually fell when the score was on 207, bowled by Tom Wells, but Andrew Salter, with a career best 54 not out and Michael Hogan and Andy Carter, plundered 91 from the last 10 overs.
Needing 324 to win from 126 overs, Leicestershire soon lost Angus Robson, who nicked at an outswinger from Meschede to Wallace. Shortly afterwards Wagg dismissed Ned Eckersley, who deflected the ball on to his stumps.
There was further success for the home team when Hogan, in his second spell, trapped Mark Cosgrove lbw for 14 after the former Glamorgan batsman had found it difficult to adapt to the slow pitch.