Novak Djokovic was forced to dig deep to defeat David Ferrer 7-5 4-6 6-3 in an epic contest and move into the semi-finals of the Rome Masters.