Earliest recorded use comes from sports and gambling in the USA and then developed into having luck in other areas.
From the Oxford English Dictionary:
Phrasal verbs
With adverbs in specialized senses. to luck out
intransitive. Originally U.S. To succeed, prosper, or gain an advantage by good luck. Also transitive.
1902 Vicksburg (Miss.) Evening Post 17 July 4/2 At the protest of the Vicksburgers who were hoping against hope, he allowed the game to proceed, with the result that instead of Vicksburg lucking out, Baton Rouge scored another run.
1904 Washington Post 3 Sept. 8/3 Any sort of a hit looked good at this stage, and Manager Donovan lucked out a bunt to Patterson on which he got a scratch hit.
1911 Washington Post 10 Mar. 7 (heading) How He Lucked Out... The man who won the biggest parlay in history.
1934 Boys' Life Aug. 46/4 Joe..remembered that he hadn't shaken hands with his opponent, hurried back, told Tyson he had ‘lucked out’.
1972 J. Wambaugh Blue Knight (1973) ii. 22 Damned if I didn't luck out and get steered into a good job.
2005 D. Nicholls Understudy 165 Remember, Josh mate, you're nothing special, you don't deserve any of this, you just lucked out.