Nice question!
I would suspect that the existence of phantom maps (see the n-Lab entry on these for starters) would suggest that the answer is a lot more complex than one would suspect. I quote
''a continuous map $f$ from a CW-complex $X$ to a topological space $Y$ is a phantom map if it is not homotopic to a constant but for every finite CW-subcomplex $Z\subset X$ the restriction $f|_Z:Z\to Y$ is homotopic to a constant."
The conditions you impose would imply that $X$ and $Y$ have the same $n$-type for all $n$. From an example of Adams in 1957, and in reply to an original question of J. H. C. Whitehead (both looking at CW-complexes rather than simplicial sets), we get that $X$ and $Y$ are not necessarily homotopy equivalent. (Do a search on `Spaces of the same n-type for all n' to get some papers relevant to this.) The obstruction is in a $lim^{(1)}$ group associated to the automorphisms of the spaces.
This is not quite an answer to yourthat question since you are specifying that $f$ is given to start with, but is clearly related to your and Harry's doubts given that you are asking for unpointed mapping spaces.
A related problem occurs in Proper Homotopy Theory and there perhaps you can find a nice conceptual example as there are geometric interpretations of the $lim^{(1)}$ groups. The intuition is that the homotopies needed to give the isomorphisms $$\mathcal{H}(K,X) \cong \mathcal{H}(K,Y)$$ cannot might not be made homotopically coherent enough to build a homotopy inverse.
Clearly in your case you need $X$ and $Y$ to have non-trivial homotopy groups in all dimensions.
I hope this helps.