I hope this isn't one that leaves me feeling stupid but....

The basic thrust equation is given as:

F = qVe + (pe - pa)*ae

Where F is thrust, q is mass flow rate, Ve is exhaust velocity, pe is exhaust pressure, pa is ambient pressure, and ae is the exit area.

I have read, and it also makes intuitive sense that an optimized nozzle where pe=pa would produce the most thrust. However, the basic equation seems to contradict that, but I'm sure I'm missing something obvious. Everything else being equal, thrust seems like it would go up as pe goes up. Set me straight!