"I'm delighted to have added Karl to the squad and he obviously comes straight into contention for the derby with Peterborough on Saturday," Gray told the club's official website.
"I've been chasing Karl for a long time, I'm delighted to have him here and we are very thankful to Preston for allowing him to come out on loan.
"I think Karl knows this division well and I remember him taking my eye when he played against us for Carlisle in one of my first games in charge here. He is an aggressive player and he has got a very good goalscoring record at this level."