This means that he was waiting in a queue to buy tickets. A queue is a waiting list, or line - so, the people who were waiting before him bought their tickets, and then it was his turn. Often, it is said that someone is, for example: "on the top" or "in the middle" of the queue, which refers to their "place in line".
So, something like this is correct:
"The next morning, he was at the top of the queue and could finally buy two tickets."