We consider a single-server queueing system with Poisson arrivals and general service times. While the server is up, it is subject to breakdowns according to a Poisson process. When the server breaks down, we may either repair the server immediately or postpone the repair until some future point in time. The operating costs of the system include customer holding costs, repair costs and running costs. The objective is to find a corrective maintenance policy which minimizes the long-run average operating costs of the system. The problem is formulated as a semi-Markov decision process. Under some mild conditions on the repair time and service time distributions and the customer holding cost rate function, we prove that there exists an optimal stationary policy which is characterized by a single threshold parameter: a repair is initiated if and only if the number of customers in the system exceeds this threshold. We also show how the average cost under such policies may be computed and how an optimal policy may efficiently be determined.