Plato --
EssexJay isn't 100% right. It all depends on how the booking was made.
If the airline messed up, and one of their agents (or their web site) booked you on an illegal connection, they'd be responsible for taking care of you.
If a TA did it, then normally the airline will take care of you, and then go after the TA's hide for issuing a ticket to an illegal booking.
As part of the ticketing process, most TA's go thru a step where they have the computer check for illegal connections.