Gillespie made 39 not out to take Yorkshire to 252 for nine in reply to Lancashire's 417 for nine declared, 16 runs short of avoiding the following-on at stumps on the second day of their First Division clash.
Yorkshire were reduced to 189 for nine before an unbeaten last-wicket stand of 63 between Australia fast bowler Gillespie, who stunned the cricket world with his double-ton against Bangladesh, and fellow quick Deon Kruis (21 not out) gave them a shot at not having to bat twice in a row.
Tom Smith took four for 55 and experienced spinner Gary Keedy three for 40.
Elsewhere Australian Travis Birt scored his first century for Derbyshire, making 119, as the hosts scored 399 for six in an innings where compatriot Michael Di Venuto fell for 93.
Elsewhere former England batsman Mark Ramprakash scored his third century (118) in as many matches as Surrey piled up 501 for seven declared against Worcestershire at The Oval.