It seems to me that the left-wing opposition wasn't very influential or organized at all — how did things get so far out of hand?
I am not sure I understand what you meant by the "left-wing opposition not being influential or organized", but it seems to me like you are saying that the coup was left-wing (a very common thing in Latin America) and that it is surprising that they pulled it off, is that so? I will explain what happened and hopefully it'll address your question. However, before I begin, keep in mind one thing: the civil-military coup in 1964 was done by the extreme RIGHT-wing, not left, in an attempt to thwart the expansion of a perceived communist influence in the Brazilian government.
In 1961, the democratically elected left-wing president Janio Quadros (National Labor Party - PTN) resigned. His vice-president, João Goulart (Brazilian Labor Party - PTB), was then automatically elected president. João Goulart, or "Jango", as he was known, was in a trip to China when that happened, which was heavily frowned upon by the right-wing (during the Cold War), who accused him of being communist and wanted to bar him from becoming president. Through negotiation, Brazil was then set to switch from presidential system to parliamentary, and Jango would be its Chief Executive instead of president.
However, a 1963 plebiscite to decide whether Brazil would switch to parliamentarism ended with the majority of the population voting to maintain presidentialism (fun fact: in 1993 there was another plebiscite to decide whether Brazil would switch to monarchy, but it didn't). So, Jango was democratically set to be the president, which angered the conservative right.
During his term, Jango made several changes that increased the fear of a communist rule, such as the nationalization of the private oil companies and de-occupation of railroad areas for land reform in 1964. Political supporters of his government proposed the substitution of the Congress for a National Assembly of farmers, factory workers, and nationalist officials. The right-wing military, the conservative wing of the church, the rich rural bourgeoisie, all supported by the United States, formed a coalition to stop the "communist danger".
The tipping point happened when a mutinous group of Navy sailors attempted to unionize and demand representation. The military saw this as a breach of discipline and moved against a government that was "corrupting" and "subverting" the people, and to this day their supporters defend that it was a "counter-revolution" rather than a coup, and that it helped prevent the installation of communism in Brazil.
They said it was going to be a "brief" intervention, but it ended up becoming a coup d'etat that led to 21 years of a right-wing military rule.