The name alludes to the complex and peculiar succession of the Earldom of Selkirk: if the Duke of Hamilton, head of the house, has a younger brother, and the Earl of Selkirk dies without surviving sons, the earldom passes to the duke's younger brother rather than to the duke himself (as would happen under the primogeniture rules that usually apply in succession to the peerage) or simply become extinct. Thus the Earldom has on three occasions (1885, 1940, 1994) passed to a duke's brother. (If Lord Selkirk has a surviving son, the title descends normally.)
In the dance, the first lady (just widowed) sets off, dances with the new Duke and then turns his younger brother before coming back to line up between the new Duke and his wife. The concept behind the dance has nothing to do with flirting, however this can be an interesting side-line.