Mechanism for formation of amide by reaction of amine with ester
Surely the negatively charged oxygen would protonate before the other
  oxygen would.


Most of the time, but not all of the time.


  The amine group is more basic than the "alcohol group" that must leave
  to form the amide so why wouldn't that protonate first and then just
  leave (i.e no reaction)?


Most of the time, but not all of the time.

Your reasoning is correct, but remember, all of these steps are equilibria.  Although what you say will happen most of the time, some of the time the reaction will take the forward route.  Presumably the reaction is run with a large excess of ammonia to "force" the reaction in the forward direction.