Technically, since there are legal methods of reaching this position with the king and rook moving prior to the start of the problem, casting rights need to be specified to give the solver a fair chance of correctly solving what appears to be a dead drawn composition. Unfortunately, that ruins the brilliance of the answer.
I knew immediately that the solution would involve castling queenside but the only question was when. Perhaps a bonus question for people to answer would be to explain why O-O-O immediately fails to win.
Enjoy this tough one!