They have an uncanny resemblance, I admit, but I'm slightly confused as to whether it was a dream or not
First, when you're on the Pirate Ship after beating the game, Link pulls out the Phantom Hourglass and sees Linebeck's Ship at sea.
Also, LA had bosses called "Nightmares", and they were called Nightmares, not bosses. It was even the Nightmare's Key instead of the Big/Boss Key.
At the very end of PH, the Ocean King says it's time for you to return to your dimension, and his time to return to his. That means that maybe the ghost ship is like... a portal or something, I don't know.
Anyway, my point is they're similar, but I don't think the whole story should be changed because of this.