I think you need to start from the most complex case, and reduce it. Somebody correct me if I go wrong - my maths is pretty underused these days.
Given a triangle with sides of lengths a,b,c and an angle between a and b of C (that ought to be theta or at least something greek, but there you go), then
c squared equals a squared plus b squared minus two times a times be times cosine x.
Also, if you have a triangle with sides a, b, c opposite vertices A, B, C, then:
a divided by sine A equals b divided by sine B equals c divided by sine C.
So if you know your wind vector and your heading vector and speed, you know the lengths of two sides and the difference between the angles of two sides. From this, you can work out everything else.
If you are using sines and cosines, you don't need to worry about whether one angle is more than another, because most calculations aren't fussy about getting an angle in the range 0 to 360 - they will work it out modulo 360. If it is fussy, then do the modulo 360 bit yourself first. If it insists on radians (does anything, these days?) then do that bit first.
Alternatively, use a flight computer.....