i would expect a #iv dim chord (or vii dim/V) to resolve either to IV or V. But i have noticed a few instances where it leads to I major.(i could mention the song title if it is allowed). Is this progression actually possible, or is it more of an exception? Thanks ☺
While Matt's answer is not wrong, I would include a few other thoughts.
My initial thought was that this could be a Common Tone Diminished chord. From my experience, this is something that has typically been associated with the Classical repertoire but could certainly be applied elsewhere. This would specifically apply to fully diminished 7 chords, not half diminished.
The analysis that Matt has provided does make sense but I would be a little careful about the interpretation. If you are reading a chart and it says Bdim7-Fmaj7, I would not assume that the Fmaj7 should have the 5 (C) in the bass; that would be written in the chart. As a bass player in a Jazz setting that could be a useful variation or interpretation but if you are trying to remain true to a chart, that interpretation would not be accurate.
(For the sake of ease of notation, I will notate absolute pitches as if I is C major.)
The OP, in a comment to the question, said "It is the Silent Night song, last line to be specific. Halfway through that line there are two consecutive dotted crotchets, the second one is usually played with a #iv dim chord". Thus the melody note in question is E and the chord is just F♯ A C. With no D♯ or E♭. So the chord is thus not enharmonically equivalent to i dim.
In Silent Night, this note of the tune is then followed by a cadential 6/4, i.e. the chord sequence Ic V I. The Ic chord could be seen as functionally V. The bass is G and is thus already the right bass for V in root position. The C and E of the Ic are non-harmony notes which then resolve to B and D of V.
Many chords may serve as a predominant, i.e. a chord which can go before a V I cadence. For example, IV, ii, V of V (that is, II), ♭VI aug6 (the German sixth chord), and your example, which as you said is ♯iv dim. In each case, a Ic chord can be inserted between this pre-dominant chord and the V chord, and the cadence still works. That's what is happening there in Silent Night. As you say, your chord may be followed by V. Given that, it is not so surprising that it may also be followed by Ic.
 A slight difference is that ♭VI aug6 contains E♭ which resolves down to D, whereas, if a Ic chord is inserted, that E♭ is renotated as D♯ because it now resolves up to E.
Enharmonically this is the same as
Idim7 -> I(maj7), which is a common progression (at least in jazz or jazzy arrangements). One famous example is the beginning of the jazz standard Misty by Erroll Garner. If you really have
#IVdim7 -> I(maj7) then you probably actually have
#IVdim7 -> I(with 5 in the bass), so the bassline moves up chromatically.
the chord tones for #IVdim are: #iv, vi, i , ##ii (where these refer to scale degrees). This contains two tones that are already part of Imaj6: vi, i And it contains two tones that lead into two more Imaj basic chord tones:
iv# --> v
so you have a chord that has two leading tones into the target chord, this is why it is a natural choice of chord in many situations.
I think we have to go deeper to understand why it works aurally.
IVdim7 could be seen as a chord build on the 5th of a B7(b9) chord.
In this case B7(b9) sounds ok to resolve to Cmaj7 Because B7(b9) is a V in minor, and in Natural and Harmonic minor scales you have the V7(b9) bVImaj7 progression as an acceptable sound. So when B7(b9) resolves to Cmaj7 you hear exactly that.
Now, let's dig deeper:
B7(b9) could be assumed to be an altered Dominant. Altered dominant can mutate to be any othe Dominant a min3rd above or below that Dominant. So B7(b9) is also D7(b9) F7(9) and Ab7(b9) From this chord menu, we found B7(b9) to work as V bVI in minor and also found F7 as a dominant in C melodic minor. In this case F7 won't work best with a b9. So you just adjust diatonically to C major by raising the b9 to 9 which is the V degree of C major. G note.