Brewers beat Cardinals 3-2, avoid sweep