It makes no difference if you buy the ticket from an agent or the airline (you might have more protection if you buy it from an agent if the agent is a member of one of the larger TA groups). As long as TWA is flying and selling tickets it makes no difference if they are in bankrupty proceding or not.
The other thing to look at are many states have inacted consumer travel protection laws that were inteneded to protect the consumer from being scamed buying travel products. If a State has one of these programs in place, all sellers of travel have to pay a yearly fee ($150-$3000) and the pool of money helps refund any consumers who have been the victims of fraud. Airlines are exempt from having to pay into this fund.
I do not agree with this type of program but that is a whole different topic.