A giant impact is an increasingly popular explanation for the formation of the northern lowland on Mars. It is plausible that at the impact time both Mars and the impactor were differentiated with solid silicate mantles and liquid iron cores. Such a large impact likely resulted in merging of the cores of both bodies, a process which will have implications on the thermal state of the planet. We model the evolution of the Martian mantle following a giant impact and characterize the thermochemical consequences of the sinking of an impactor's core as a single diapir. The impact heating and the viscous heating induced during the core merging may affect the early thermal state of Mars during several tens of million years. Our results show that large viscosity contrasts between the impactor's core and the surrounding mantle silicates can reduce the duration of the merging down to 1 kyr but do not modify the merging temperature. When the viscosity contrast between the diapir and the surrounding silicates is larger than a factor of 1000, the descent of the diapir can lead to some entrainment of the relatively shallow silicates to deepest regions close to the core-mantle boundary. Finally, the direct impact heating of Martian core leads to thermal stratification of the core and kills the core dynamo. It takes on the order of 150-200 Myr to reinitiate a strong dynamo anew. The merging of the impactor's core with the Martian core only delays the reinitiation of the dynamo for a very short time.