Well.. There is basically NOTHING that can go wrong with a thermocouple flame sensor save for bad connections.
BUT there is plenty that can go wrong with the flame it senses.. I would start with proper cleaning and adjusting of the pilot burner ... If there is anything obstructing the pilot that can cause a reduced flame.
Also, You say the pilot goes OUT when the main burner kicks in This strongly suggests that the problem is NOT the flame sensor (Thermocouple) since if it were not sensing flame the main burner would not kick in.
But it also suggests a bad pilot flame.. So again, I'd clean the pilot first.