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.
If you want to ever have a chance to progress and develop your economy then these criticisms are everything. On the other hand if you have a developed economy and already lead in many sectors then you can follow these sorts of rules and still be fine. The point of this as ideology is simply to try to cement the "natural" order of things. It's failed mostly because of work of heterodox economists from the countries effected negatively by such ideology like South Korea.
Edit: "the other way around" isn't quite right, I thought you were making a point besides the one you were actually making. Hurpadurpa.