Mark Selby came from 4-0 down to beat Neil Robertson 6-4 in their quarter-final at the UK Championship in a match that finished after midnight.