I have heard in certain songs the usage of a diminished chord in a major tonality which I think is not constructed over the seventh degree nor over the second degree.
Moreover, in the two examples at which I have found this resource, I have noticed that it is used with the same chord-sequence: I - i°? - I.
The two examples I mention are these ones:
John Field - Nocturne no 5 in B flat major (at the second beat)
How and why does this technique work? Does it have any particular name?