Calicut is nearer to Palakkad, so suggested.
Even without considering train, just the bus distance from Calicut to Palani is some 240 Kms. So many KSRTC buses to Palakkad, and immediately you get Pollachi buses there itself and then finally from Pollachi to Palani. The entire journey from Calicut to Palani is just 6 hrs.
Anyway, I travelled a long ago, then it had a frequency of some 1 hr -2 hr between buses. Now no idea.