The Canadian reached the quarter-finals of the French Open last week, but fell short at the ATP 250 grass-court tournament event in Halle against a player ranked 111 places lower - losing 4-6 4-6.
In a tight first set, Gojowczyk made the break to go 4-3 up and eventually served to love to claim the opener.
Raonic will have been hoping for a better start to the second than to see his serve broken instantly, but that is exactly what happened.
The world number nine threatened to break back at 4-2 down, but his German opponent held on to see out the match.
Gojowczyk will now meet Colombia's Alejandro Falla, who overcame Robin Haase 7-6 (7-1) 6-4.
The Dutchman accounted for the exit of fifth seed Richard Gasquet in the last round and was a break up in the second set before Falla came back to seal victory.
Japanese fourth seed Kei Nishikori needed three sets to see off France's Gael Monfils 6-1 3-6 6-3.
After opening the match by winning five games in a row, a single break of serve for Monfils settled the second set.
However, Nishikori recovered to outnumber his opponent by two breaks to one in the decider.
In the day's remaining encounter, Philipp Kohlschreiber defeated Pierre-Hugues Herbert 6-2 6-4 to set up a quarter-final meeting with French Open champion Rafael Nadal or wildcard Dustin Brown, who face each other on Thursday.