I am pretty sure they are considered separate transactions. I.e. the miles are one purchase, and the ticket is another purchase -- and 24 hour refund policies only apply to purchases of tickets. Only the ticket would be refunded, and you would have these extra miles in your account still.