If declarer has seven spades, there can be no hope to of scoring a diamond trick even if partner has the king. If declarer has six spades, it could be right to overtake and return a diamond before before declarer can establish clubs. For example, if declarer has either:
K Q J x x x x x x x x x x
K Q J x x x x x x x x x x,
a diamond switch at trick four is necessary.
But who would open three spades vulnerable against not with either of those hands, and why did partner play the Q instead of the jack at trick one?
May be he was trying to tell you something. Actually partner was trying to tell you that he did not have the K by playing his hearts in unusual fashion. The winning return at trick four is a heart, allowing partner to uppercut with the J, establishing your 10 as the setting trick!
Bridge Today, Jan-Feb 1993, Eddie kantar, p. 19