Stojanovic scored his third goal of the season after his shot over Miami's wall of defenders was mishandled by goalkeeper John McCarthy, who let it slip through his grasp and into the goal.
The tally was Chicago's first goal since April 24, snapping a three-match scoreless streak and a string of four consecutive losses for the Fire (1-4-1, 4 points). It was also Chicago's first victory in 12 matches.
Inter Miami (2-3-2, 8 points) lost for the first time on the road this season.
Ironically, McCarthy had just made two clutch saves in the first 15 minutes of the second half to preserve a scoreless tie.
The Fire dominated the match with an attack that began setting up quality opportunities within the first few minutes. Chicago outshot Miami 19-4 overall and 7-1 in shots on goal. Chicago controlled possession for 57.4 percent of the match.
Inter Miami defender Nico Figal returned to action, but defender Kevin Leerdam was still out. Miami lost Robbie Robinson in the 69th minute to a leg injury. Inter Miami was then forced to finish the match with 10 players after they had already made their five possible substitutions.
Inter Miami drew six yellow cards, including defender Leandro Gonzalez Pirez, who was back in the starting lineup. Gonzalez Pirez picked up his yellow in the 22nd minute after a challenge on a header to Chicago forward Fabian Herbers. As a result, Gonzalez Pirez will be forced to sit out Inter Miami's next game May 29 against D.C. United.
The Higuain brothers nearly connected on a goal in the 38th minute, but Federico's attempt off a cross from Gonzalo went wide of the goal.