For arguement's sake, I'll assume that you are a U.S. citizen. If this is the case, then you definitely need a "return or onward ticket" according to TIMATIC. The only remotely relevant exception is for "merchant seamen travelling on duty and holding Letter of Guarantee issued by shipping company," I suspect this doesn't apply to you.
In my opinion, you should be glad that HP boarded you. Simply "talking to immigration" provides neither them nor you with any real assurance you'll be granted entry to the country. I see it happen all the time, some distraught person with entry docs that don't meet the formal letter of the law pleading with immigration to be granted entry into the country based upon some sort of verbal assurance they claim to have received from someone in authority before hand (embassy, consultate, immigration dept, gov't employee on prior visit, etc., etc.).
AA is pretty clear that it is the passenger's responsibility, not the airline's, to educate him/herself and comply with all immigration requirements. If it were me (and it has been, although not in Costa Rica), I would have (and actually have) purchased a one-way fully refundable ticket out of the country in question to satisfy the entry requirements.