Desperately ill Scots have taken part in world-first research to help halt the growth of antibiotic-resistant superbugs.