It all depends on the arrival of SW monsoon. It it hits the bulls eye, then it is best not to visit Ooty by July. Maybe you can plan for the second season that is between September and October, which is the period between the SW and NE monsoons. If you miss that rail, then ideally Jan is second best in that it would not be that expensive and not much rush in Ooty. December should be avoided as it gets cold out there and fog will also play spoilsport.