I'm on a Tier 2 general visa valid till 2020 and I have to go to India for an emergency next week. My passport is valid until October 2018. Will there be any problem during travel at any stage, particularly at Indian immigration when I'm returning back?
Many countries will allow their citizens to enter their own country even if they have no passport at all (as long as they can prove their citizenship). Travelling into India with an expired passport should be possible, although you would need a valid passport to leave. (Although it might be tricky boarding a flight to India with an expired passport, but that's up to the airline.)
If your passport has any validity on it at all when flying to India, you will have no problem entering India.
You will need to get a new passport while you are in India, and either get your UK visa transferred to it at a British embassy/consulate, or take both your old passport (containing your valid UK visa) and your new passport with you when you go back to the UK later.