The pebble was what enabled Rocko to fly.When Hubie made his wish, he wished at /that moment/ to find the perfect pebble, which is why the wish came true in the form of a pebble. But the pebble came down to earth as a star falling- meaning the pebble essentially was the star he had wished on. What he really wanted, most of all, was to win Marina's heart. Drake shoved Hubie off the ice while trying to get his pebble, with the side effect that Hubie plunged to the seal-infested waters. Drake was perfectly happy with this. However, if Drake hadn't done that Hubie never would have gotten taken onto the Good Ship Misery or met Rocko. If he hadn't met Rocko he never would have learned to fight or to have confidence, which means that if the whole adventure hadn't happened Hubie probably would have wound up killed by Drake anyway. Eventually Hubie lost the pebble and Rocko got it for him, but Rocko had it for a while before he could give it back to Hubie. I don't think Rocko ever flew before the first scene he's shown flying in. I think that as he was diving, he wished with all his heart that he could fly- as he's obviously done many times before- and because he had the 'star' with him, it granted his wish.
Rocko never learned to fly.It's all Hubie's fantasy of how things should have went. Rocko only managed to hold him before they hit the ground and died. The happy end is a Dying Dream that features everything Hubie wanted: he gets Marina, Rocko can fly and is happy, and they're all safe and welcomed home.