Ben Close’s cross-shot beat Luke Daniels six-minutes into time added on when the game appeared to be heading towards a stalemate.
Harrison Biggins’ 35th minute overhead kick was cancelled out by Jordan Moore-Taylor’s late header before Close’s winner.
Forest Green winger Kyle McAllister produced a low cross for Troy Deeney but his effort cannoned back out of the crossbar from close range.
Minutes later, Matty Stevens guided Teddy Jenks’ miscued effort goalward but was denied by the woodwork, and also closely followed by McAllister hit the post from Stevens’ cross.
Doncaster took the lead after 35 minutes when Biggins produced an overhead kick that slammed into the far corner from Tom Nixon’s wicked delivery.
Forest Green found their equaliser through Moore-Taylor after he headed home an inviting Marcel Lavinier corner.
Substitute Close then won it in stoppage time when Close’s cross was misjudged by Daniels and ensured Doncaster moved off the bottom of League Two.