Grigor Dimitrov converts his third match point - over 24 hours after his first - to beat Britain's Jacob Fearnley and reach the Madrid Open quarter-finals.