GUA sends you directly to immigration. You disembark and are walking one floor above the boarding gates. There's no mixing with the departing passengers at the gates when you arrive.
My concern about trying this at SJO is that it is physically possible, yes, but who is going to check you in for your return flight? Will they give you the SJO-MIA boarding pass at your originating airport XXX?