Derry City showed great determination to come from behind to see off Cork City 2-1 at the Ryan McBride Brandywell Stadium.