2 clarified (I hope)
source | link

The other answers (so far) do a good job of explaining the usage of "it" but they don't explain your specific examples. #1 could be rewritten as "Our car broke down, but luckily there was a garage nearby". In other words, you were fortunate enough to break down near a garage. #2 could be "I arrived a little late, and unfortunately the last ticket had just been sold".   In this case, luck was not on your side -- "as luck would have it" is neither positive nor negative, but is simply saying that luck played a role in the outcome of events.

Personally, for #2 I'd prefer "I arrived a little late and, just my luck, the last ticket had just been sold" for #2. ("Just "Just my luck" is ananother idiomatic expression for when something unlucky/unfortunate has happened to you.)

If it helps you to understand the meaning, you can probably substitute "as if by fate" in most examples of "as luck would have it" (assuming you are willing to accept that luck and fate are pretty much the same). That gets rid of the troublesome "it" and still conveys the same message: that invisible powers beyond your control seem to have conspired to make something happen, for better or for worse.

The other answers (so far) do a good job of explaining the usage of "it" but they don't explain your specific examples. #1 could be rewritten as "Our car broke down, but luckily there was a garage nearby". #2 could be "I arrived a little late, and unfortunately the last ticket had just been sold".  

Personally, I'd prefer "I arrived a little late and, just my luck, the last ticket had just been sold" for #2. ("Just my luck" is an idiomatic expression for when something unlucky/unfortunate has happened to you.)

If it helps you to understand the meaning, you can probably substitute "as if by fate" in most examples of "as luck would have it" (assuming you are willing to accept that luck and fate are pretty much the same). That gets rid of the troublesome "it" and still conveys the same message: that invisible powers beyond your control seem to have conspired to make something happen, for better or for worse.

The other answers (so far) do a good job of explaining the usage of "it" but they don't explain your specific examples. #1 could be rewritten as "Our car broke down, but luckily there was a garage nearby". In other words, you were fortunate enough to break down near a garage. #2 could be "I arrived a little late, and unfortunately the last ticket had just been sold". In this case, luck was not on your side -- "as luck would have it" is neither positive nor negative, but is simply saying that luck played a role in the outcome of events.

Personally, for #2 I'd prefer "I arrived a little late and, just my luck, the last ticket had just been sold". "Just my luck" is another idiomatic expression for when something unlucky/unfortunate has happened to you.

If it helps you to understand the meaning, you can probably substitute "as if by fate" in most examples of "as luck would have it" (assuming you are willing to accept that luck and fate are pretty much the same). That gets rid of the troublesome "it" and still conveys the same message: that invisible powers beyond your control seem to have conspired to make something happen, for better or for worse.

1
source | link

The other answers (so far) do a good job of explaining the usage of "it" but they don't explain your specific examples. #1 could be rewritten as "Our car broke down, but luckily there was a garage nearby". #2 could be "I arrived a little late, and unfortunately the last ticket had just been sold".

Personally, I'd prefer "I arrived a little late and, just my luck, the last ticket had just been sold" for #2. ("Just my luck" is an idiomatic expression for when something unlucky/unfortunate has happened to you.)

If it helps you to understand the meaning, you can probably substitute "as if by fate" in most examples of "as luck would have it" (assuming you are willing to accept that luck and fate are pretty much the same). That gets rid of the troublesome "it" and still conveys the same message: that invisible powers beyond your control seem to have conspired to make something happen, for better or for worse.