Before we start, I'm aware the result is true for when the function is a map between Euclidean spaces. In fact, with a minimal amount of extra work we can see that a function between locally-compact, locally-connected topological spaces which preserves connected and compact subsets is in fact continuous.
My question is for an example of a function which preserves compact and connected subsets but is not continuous. I've found a minimal example with the two point space and the identity function where the Sierpinksi space is the domain and the image space has the discrete topology. Now I want something a little more interesting. Can anyone come up with an example where the domain and codomain are Hausdorff?