Take a look at the original sentence again:
Gustavo can tolerate any lecture, no matter how boring the instructor
is, in his mind, Gustavo imagines that he
is on board the starship Enterprise, blasting Romulans from his
post on the bridge.
You chose to fix it the correct way:
Gustavo can tolerate any lecture, no matter how boring the instructor
is; in his mind, Gustavo imagines that he
is on board the starship Enterprise, blasting Romulans from his
post on the bridge.
Gustavo can tolerate any lecture is the first main clause. In his mind, Gustavo imagines ... is the second main clause. You are always correct when you use a semicolon between the two main clauses that create the comma splice.