The Robins, who had looked down and out after trailing 18-0 and 24-10, had clawed their way back to within four points but Cockayne ended their fightback with a hat-trick of match-clinching tries in the last 20 minutes.
Wildcats coach Richard Agar had labelled the performance against the Bulls as the worst since he took charge but the return of 2012 player of the year Tim Smith and ever-reliable prop Andy Raleigh helped transform them.
However, until Cockayne's late burst, it seemed the sin-binning of Graeme Horne (Hull KR) and Danny Kirmond (Wakefield) were going to provide the pivotal moments.
Wakefield scored 18 points with a man advantage while the visitors responded with 10 when their opponents were down to 12 men.
Paul Aiton, Reece Lyne, Peter Fox and Dean Collis also crossed for the Wildcats, with Cory Paterson, Craig Hall and Josh and David Hodgson the try-scorers for Hull KR.
Meanwhile, the Catalan Dragons brushed aside the challenge of opponents Salford, winning 40-6 despite losing up and coming prop Julien Bousquet in the third minute to a red card.
The visitors trailed 16-6 at the break - but had no reply to their hosts' power after the turnaround despite the numerical advantage.
Vincent Duport (2), Remi Casty, Steve Menzies, Ian Henderson, Olivier Elima and Daryl Millard crossed for the Dragons, with Niall Evalds managing the visitors' only try.