Tim Paine guides Australia to remarkable draw