The Captaincy of Cuba was under the jurisdiction of New Spain, under the international norm of uti possidetis juris this gives Mexico a legal claim, one I believe independent Mexico did put forth but never acted upon. Say the Mexican-American War doesnt happen, or turns stalemate with ante-bellum boundaries then I can see that if the US still goes into a *Civil War perhaps Mexico takes the opportunity to invade Cuba. (This may be more likely under a scenario where there is no Emperor Maximilian as well)