Police officers with guns drawn dragged an alleged carjacker from an overturned car through a smashed window after a crash that closed off southbound highway traffic north of Brisbane.

The allegedly stolen car flipped on the Bruce Highway at the Sunshine Coast and the accident scene blocked all southbound lanes for almost three hours, creating kilometres of delays.

A man and woman were arrested and a firearm, believed to be a shotgun, was found in the car.

It will be alleged the pair stole the white Toyota Corolla from a woman at gunpoint on Charlton Esplanade in the Hervey Bay suburb of Pialba about 10am on Friday.