Hi Nick
I had the same problem when I traveled from Brazil to Mexico - Cuba few years ago.
I thought that once I will be in Brazil I will find some cheap opption which is not on the net but I was wrong. I had a ticket from Cancun to Havanna with Cuban Airlines quite cheep I think for £100 return but to Cancun I had to take a flight from Sao Paulo via Panama with Copa Air what was around $600 one way and I bought it week in advance what might be the reason why it was so expensive.
You dont need any visa for the transfer just make sure that you change your time once you are there because I forgot about it, had a nap and nearly missed the flight.
Hope that will help and if you have any other questions let me know. I went from Buenos Aires down to the south of Argentina, took Ruta 40 to Iguacu falls from there by bus to Sao Paulo, Rio de Janeiro, Santos, flew to Mexico - Cuba, travel around the island ( quite extraordinary experience) and back to Mexico, from Tulum, Merida, Palenque, Villahermosa to Mexico City.
Take care,
SuE