Stuttgart started the brighter of the two teams but Bayern should have taken the head, only for Olise and Jamal Musiala, in particular, to spurn gilt-edged chances.
Deniz Undav then struck the outside of the post, before the hosts went ahead in the 34th minute courtesy of Angelo Stiller's thunderbolt from 20 yards.
Former Crystal Palace star Olise then equalised on the stroke of half time after being put through on goal by Leroy Sane.
Leon Goretzka created something out of nothing after he picked Stiller's pocket just outside his own box and then fired past Alexander Nubel in the 64th minute.
The visitors nearly went 3-1 up when substitute Kingsley Coman's effort hit the wrong side of the post but they finally got their two-goal cushion as the French winger capitalised on Josha Vagnoman's mistake to fire home in the 90th minute.
Bayern eased home to earn a crucial three points at MHPArena to put even more daylight between them and second-placed Leverkusen - with Xabi Alonso's team visiting Eintracht Frankfurt on Saturday.