It wasn't so much a change in heart as it was the natural and common progression of disappointment which prideful people display. After a prideful person sees that the object of their pride doesn't meet their standard they may disavow that object.
While John loved Jesus unconditionally Peter showed pride in aspects of Jesus' life and ministry as well as loving Him. That pride interfered with his love. Peter was proud of the Teaching, Preaching, Healing and Delivering Messiah as well as even the Dying Messiah but he was not proud of the Humiliated and Suffering Messiah.
Peter was willing to die immediately for Jesus in his own way with a sword in his hand rather than God's way for him to die years later on a cross of his own (as far as we know). His actions against the representatives of the evil rulers of the people of Israel are not venerable. Its a kind of false fleshy courage based in pride. Can you hear the pride in this statement: "If God wants me to do it I'm doing it my way when I want." It's seen in the contemporary world when people may say things like this: "You're not going to talk bad about or hurt my wife/child/husband/friend." This defensiveness is sometimes healthy but can become unhealthy because punishment is sometimes necessary. The punishment of Christ for us was necessary. Jesus did instruct the disciples to carry a sword but He never authorized them to use it in His defense. His Kingdom isn't of this world and if Peter had been listening he would have known that. Besides Jesus didn't need Peter to attack them. All He had to say was I AM and they would have kept falling over. Peter's pride is also shown in how he rebuked the Lord and he didn't ask questions concerning the Lord's death which Jesus had already announced as unavoidable. Satan desired to sift Peter like wheat and nearly was able to because Peter wasn't willing to suffer in the form of humiliation and abasement rather than death with Jesus.