I think it's actually the other way around. Ricardo's models show that individuals stand to gain from trading with individuals who have different opportunity costs, and at least in simplified scenarios it seems to check out. It's when you look at the bigger picture that things get tricky. Does country A want to rely on country B for oil/food/weapons/whatever-else-they-need-to-survive? That could cause issues. Are imports causing competition with a fledgling segment of your economy that you want to become competitive on the global stage, but which isn't yet? Maybe importing massive amounts of cheap electronics today will prevent you from becoming a major exporter of electronics in the future, because local investment of time and money will be directed elsewhere; maybe this is fine, and maybe it isn't, depending on your goals. There are reasons to block trade that don't have to do with immediate efficiency. Absent of these reasons, Ricardo (sadly) seems to be mostly correct.
Edit: "the other way around" isn't quite right, I thought you were making a point besides the one you were actually making. Hurpadurpa.