Someone made a mistake somewhere, as this should not have happened.
The question I have is, why would LA not let you on the flight 45 minutes prior to departure. First of all, I believe that a "check-in deadline" does not apply if you are connecting. If this is the case, then LA just declared that you were to late to board in time. With 45 minutes to spare this sems very strict.
Secondly, the airline could have waived any check-in deadline if it did apply.
In similar circumstances I have often found that (i) the check-in agents had already closed the flight and did not want to be bothered with a late passenger, or (ii) the flight was oversold and they had already given away the seat. In both of these cses, LA would be the one to blame. Not that this will help you to get any compensation, as they will just claim that you were to late to make the flight.
Your story just confirms my belive that it is never a good idea to connect in the U.S., where you have to go through immigration, customs and a security check when not even entering the country. Going via MAD might be the better choice.