The Saudi-Iran controversy reminds me somehow of the Pakistan-India controversy. Just as Pakistan Saudi Arabia is no match for its adversary. Yet both are unable to reconcile their junior position with their megalomaniac sense of self importance and so they resort to coalition building and terrorism.
Both Pakistan and Saudi Arabia are rather recent states without a strong identity. Both see their right of existence sometimes disputed. Both are ruled by greedy elites: the army and the landed elite in Pakistan and the Saudi royal family in Saudi Arabia.
When a leftish nationalism rose in other newly formed countries both Pakistan and Saudi Arabia chose to stress religion as a counterrevolutionary measure. Both have trouble with most of their neighbors due to their desire to exert influence over their borders. Pakistan has trouble with India, Afghanistan and to a lesser extend also Iran. Saudi Arabia has not only trouble with Iran, but also with Iraq, Egypt and Yemen.
In both the cases the US has initially been drawn to that weaker megalomanic party despite its obvious unreliability - hoping that the obvious needs would result in a reliable partnership. Instead both have hurt the US by sponsoring terrorism. Both have been hurt by that terrorism themselves too but that hasn't stopped them.
China's position with Pakistan is a bit comparable to that of the US. It too is draw by the obvious need but appalled by the unreliability of the partner.