A novel flexible discipline for providing priority in a single-server queue is applied to the system where the service can be unreliable what results in the loss of a customer or repetition of its service. According to this discipline, arriving customers are stored in the finite buffers dedicated to the customers of the corresponding type if the buffer is not full. After the staying in the corresponding buffer during the exponentially distributed time, the customers try to enter the main buffer of a finite capacity which is common for both types of customers. If this main buffer is full, the customer returns to the dedicated buffer and repeats the attempts to enter the main buffer later. Customers staying in the dedicated buffers are impatient and can go away from the system after a certain patience period duration of which has an exponential distribution. Customers of both types, which succeed to enter the main buffer, are picked up for the service in the order of their admission to this buffer. Providing the preference to priority customers is managed via the corresponding choice of capacities of the dedicated buffers and the rate of trials to transfer to the main buffer. Performance measures of this system are obtained under the assumption that the arrival flows of two types of customers are defined by the Markov arrival processes and the service time has the distribution of phase-type with failures type. Some aspects relating to an optimal choice of the parameters of the system are discussed via numerical experiments. © 2021, Springer Nature Switzerland AG.