In Pirates of the Caribbean: Curse of the Black Pearl, the monkey steals a coin from the chest and becomes cursed, a plot shown after the credits. Mr. Gibbs and the other crew members sailed away from the island. In Pirates of the Caribbean: Dead Men's Chest, the monkey was on the ship. So, when and how did it (monkey) get on the Black Pearl?
I am sure the monkey stole the coin after the ship sailed away. The reason I say this is because they show the ship sailing away before the curse is lifted (when Barbossa gets shot). If the monkey had stolen the coin before that, then the curse would not have been lifted as there would still be one coin missing. However, there might be one other explanation. The crew, after they rescue Jack at the end and are being chased by Norrington, come back to Isla de Muerta (possibly to get the rest of the treasure) and that's when the monkey gets back on the ship. There is a remark made by Gibbs in Dead Man's Chest about the Isla de Muerta and the treasure being reclaimed by the sea.
Even though the scene is an after credits scene, it could have taken place before the ships sailed away. Nothing in the scene itself makes that impossible, although it is a bit quiet, I suppose they could all have been preparing the ships to set off, and he snuck away to steal the coin...
Obviously the writers themselves probably didn't think about the scene a great deal since it's more of a gag, but I don't think it necessarily presents a plot-hole.