Ben Whiteman scored an 87th-minute winner as Doncaster snatched a 3-2 victory over 10-man Bradford in the first round of the Carabao Cup at Valley Parade.
Doncaster went ahead after eight minutes with a close-range shot from Alfie May after a mix-up in the Bradford defence.
John Marquis was tackled by Tony McMahon as he tried a shot, but the ball spun towards goal and, although Colin Doyle managed to save, he could only push the ball into the path of May who slotted home.
Bradford equalised in the 34th minute with a superb first goal for the club from Dominic Poleon, the 23-year-old firing home a right-foot shot after a surging run down the right by Omari Patrick.
The home side suffered a major setback in the 60th minute when they were reduced to 10 men as captain Romain Vincelot was given his marching orders.
He was sent off for a late tackle on May and Doncaster took advantage by regaining the lead in the 71st minute through Rodney Kongolo, who netted at the second attempt after Doyle had saved the midfielder's first shot.
Bradford equalised for a second time in the 83rd minute when Paul Taylor's effort rebounded into the path of fellow substitute Alex Jones to fire into the net, but Whiteman had the last word four minutes later with a shot into the bottom corner from just outside the box to win the match.