You would hope for the sake of things that if ( and this is theoretical) such a situation arose then they would step down as Deputy leader of the party, but if in a hypothetical situation you had a deputy who was desperate to be leader, they may think remaining as deputy would best enable them to undermine the current leader and to help them become leader.
I have no idea how such a situation would work, in the same way, I don't know how a party could remove a now unpopular leader or deputy leader from their party roles. Are their rules in the constitution for this to happen? We obviously know there are for the Tories as this happened in the last Parliament with no confidence letters to the 1922 Committee