The paper presents a method for deriving the optimal solution of a class of mathematical programming problems, associated with discrete-event systems and in particular with queueing models, while using a single sample path (single simulation experiment) from the underlying process. The present method, called the score function method, is based on probability measure transformation derived from the efficient score process and generating statistical counterparts to the conventional deterministic optimization procedures (e.g. Lagrange multipliers, penalty functions, etc.). Applications of the method to optimization of various discrete-event systems are presented, and numerical results are given.